utils

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireAdvisoryLock

func AcquireAdvisoryLock(ctx context.Context, dbConnectionPool db.DBConnectionPool, lockKey int) (bool, error)

AcquireAdvisoryLock attempt to acquire an advisory lock on the provided lockKey, returns true if acquired, or false not.

Types

type DefaultPrivateKeyEncrypter

type DefaultPrivateKeyEncrypter struct{}

func (*DefaultPrivateKeyEncrypter) Decrypt

func (e *DefaultPrivateKeyEncrypter) Decrypt(message, passphrase string) (string, error)

func (*DefaultPrivateKeyEncrypter) Encrypt

func (e *DefaultPrivateKeyEncrypter) Encrypt(message, passphrase string) (string, error)

type HorizonErrorWrapper

type HorizonErrorWrapper struct {
	StatusCode  int
	Problem     problem.P
	Err         error
	ResultCodes *horizon.TransactionResultCodes
}

HorizonErrorWrapper is an error that occurs when a horizon response is not successful.

func NewHorizonErrorWrapper

func NewHorizonErrorWrapper(err error) *HorizonErrorWrapper

func (*HorizonErrorWrapper) Error

func (e *HorizonErrorWrapper) Error() string

func (*HorizonErrorWrapper) HasResultCodes

func (e *HorizonErrorWrapper) HasResultCodes() bool

func (*HorizonErrorWrapper) IsBadAuthentication

func (e *HorizonErrorWrapper) IsBadAuthentication() bool

IsBadAuthentication verifies if the Horizon Error is related to invalid transaction or operation signatures.

func (*HorizonErrorWrapper) IsDestinationAccountNotAuthorized

func (e *HorizonErrorWrapper) IsDestinationAccountNotAuthorized() bool

IsDestinationAccountNotAuthorized verifies if the Horizon Error is related to the destination account is not being authorized by the asset issuer to receive the asset.

func (*HorizonErrorWrapper) IsDestinationAccountNotReady

func (e *HorizonErrorWrapper) IsDestinationAccountNotReady() bool

IsDestinationAccountNotReady verifies if the Horizon Error is related to the destination account of the transaction. It gathers all errors that would happen in a transaction because of a misconfiguration of the destination account.

func (*HorizonErrorWrapper) IsDestinationNoTrustline

func (e *HorizonErrorWrapper) IsDestinationNoTrustline() bool

IsNoTrustline verifies if the Horizon Error is related to the destination account not having a trustline for the asset being sent.

func (*HorizonErrorWrapper) IsGatewayTimeout

func (e *HorizonErrorWrapper) IsGatewayTimeout() bool

func (*HorizonErrorWrapper) IsHorizonError

func (e *HorizonErrorWrapper) IsHorizonError() bool

func (*HorizonErrorWrapper) IsLineFull

func (e *HorizonErrorWrapper) IsLineFull() bool

IsLineFull verifies if the Horizon Error is related to the destination account not having sufficient limits to receive the payment amount and still satisfy its buying liabilities.

func (*HorizonErrorWrapper) IsNoDestinationAccount

func (e *HorizonErrorWrapper) IsNoDestinationAccount() bool

IsNoDestinationAccount verifies if the Horizon Error is related to the destination account not existing.

func (*HorizonErrorWrapper) IsNoIssuer

func (e *HorizonErrorWrapper) IsNoIssuer() bool

IsNoIssuer verifies if the Horizon Error is related to the issuer of the asset not existing.

func (*HorizonErrorWrapper) IsNoSourceAccount

func (e *HorizonErrorWrapper) IsNoSourceAccount() bool

IsNoSourceAccount verifies if the Horizon Error is related to the source account not being found.

func (*HorizonErrorWrapper) IsNotEnoughLumens

func (e *HorizonErrorWrapper) IsNotEnoughLumens() bool

IsNotEnoughLumens verifies if the Horizon Error is related to the transaction attempting to bring the source account lumens balance below the minimum reserve.

func (*HorizonErrorWrapper) IsNotFound

func (e *HorizonErrorWrapper) IsNotFound() bool

func (*HorizonErrorWrapper) IsRateLimit

func (e *HorizonErrorWrapper) IsRateLimit() bool

func (*HorizonErrorWrapper) IsSourceAccountNotAuthorized

func (e *HorizonErrorWrapper) IsSourceAccountNotAuthorized() bool

IsSourceNotAuthorized verifies if the Horizon Error is related to the source account not having authorization from the asset issuer to send the asset.

func (*HorizonErrorWrapper) IsSourceAccountNotReady

func (e *HorizonErrorWrapper) IsSourceAccountNotReady() bool

IsSourceAccountNotReady verifies if the Horizon Error is related to the source account of the transaction. It gathers all errors that would happen in a transaction because of a misconfiguration of the source account.

func (*HorizonErrorWrapper) IsSourceNoTrustline

func (e *HorizonErrorWrapper) IsSourceNoTrustline() bool

IsSourceNoTrustline verifies if the Horizon Error is related to the source account not having a trustline for the asset being sent.

func (*HorizonErrorWrapper) IsTxInsufficientFee

func (e *HorizonErrorWrapper) IsTxInsufficientFee() bool

IsTxInsufficientFee verifies if the Horizon Error is related to the fee submitted being too small to be accepted by to the ledger by the network.

func (*HorizonErrorWrapper) ShouldMarkAsError

func (e *HorizonErrorWrapper) ShouldMarkAsError() bool

ShouldMarkAsError determines whether a transaction neeeds to be marked as an error based on the transaction error code or failed op code so that TSS can determine whether it needs to be retried.

func (*HorizonErrorWrapper) Unwrap

func (e *HorizonErrorWrapper) Unwrap() error

type PrivateKeyEncrypter

type PrivateKeyEncrypter interface {
	Encrypt(message string, passphrase string) (string, error)
	Decrypt(message string, passphrase string) (string, error)
}

type PrivateKeyEncrypterMock

type PrivateKeyEncrypterMock struct {
	mock.Mock
}

func (*PrivateKeyEncrypterMock) Decrypt

func (pke *PrivateKeyEncrypterMock) Decrypt(message, passphrase string) (string, error)

func (*PrivateKeyEncrypterMock) Encrypt

func (pke *PrivateKeyEncrypterMock) Encrypt(message, passphrase string) (string, error)

type TransactionStatusUpdateError

type TransactionStatusUpdateError struct {
	Status   string
	TxID     string
	ForRetry bool
	// Err is the underlying error that caused the transaction status update to fail.
	Err error
}

TransactionStatusUpdateError is an error that occurs when failing to update a transaction's status.

func NewTransactionStatusUpdateError

func NewTransactionStatusUpdateError(status, txID string, forRetry bool, err error) *TransactionStatusUpdateError

func (*TransactionStatusUpdateError) Error

func (*TransactionStatusUpdateError) Unwrap

func (e *TransactionStatusUpdateError) Unwrap() error

Jump to

Keyboard shortcuts

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