transaction

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationResultOK = iota
	AuthorizationResultRejected
	AuthorizationResultInvoiceError
)

Variables

View Source
var (
	SubmitTransactionCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: "agora",
		Name:      "submit_transaction",
		Help:      "Number of submit transaction requests",
	}, []string{"api_version"})
)

Functions

func AppIDFromTextMemo added in v0.2.3

func AppIDFromTextMemo(memo string) (appID string, ok bool)

AppIDFromTextMemo returns the canonical string AppID given a memo string.

If the provided memo is in the incorrect format, ok will be false.

func SignEnvelope

func SignEnvelope(envelope *xdr.TransactionEnvelope, network build.Network, seed string) (*xdr.TransactionEnvelope, error)

SignEnvelope signs a transaction envelope with the specified seed and network passphrase.

Types

type Authorization added in v0.2.3

type Authorization struct {
	Result        int
	InvoiceErrors []*commonpb.InvoiceError
	SignResponse  *signtransaction.SuccessResponse
}

type AuthorizationResult added in v0.2.3

type AuthorizationResult int

type Authorizer added in v0.2.3

type Authorizer interface {
	// Authorize authorizes the provided transaction.
	//
	// Callers must perform actual submission, and any persistence
	// related to the transaction, such as invoice storing.
	Authorize(context.Context, Transaction) (Authorization, error)
}

Authorizer authorizes transactions.

func NewAuthorizer added in v0.2.3

func NewAuthorizer(
	mapper app.Mapper,
	configStore app.ConfigStore,
	webhookClient *webhook.Client,
	limiter *Limiter,
) (Authorizer, error)

NewAuthorizer returns an authorizer.

type Limiter added in v0.2.3

type Limiter struct {
	// contains filtered or unexported fields
}

Limiter limits transaction based on app index.

If no app index is provided, only the global rate limit applies.

func NewLimiter added in v0.2.3

func NewLimiter(ctor rate.LimiterCtor, globalLimit, appLimit int) *Limiter

NewLimiter creates a new TransactionLimiter.

func (*Limiter) Allow added in v0.2.3

func (t *Limiter) Allow(appIndex int) (bool, error)

Allow returns whether or not a transaction for a given app index is allowed to be processed.

type Memo added in v0.2.3

type Memo struct {
	Memo *kin.Memo
	Text *string
}

type Transaction added in v0.2.3

type Transaction struct {
	Version     version.KinVersion
	ID          []byte
	Memo        Memo
	OpCount     int
	InvoiceList *commonpb.InvoiceList
	SignRequest *signtransaction.RequestBody
}

Directories

Path Synopsis
ingestion/dynamodb/committer
Package dynamodb implements a dynamodb backed ingestion.Committer.
Package dynamodb implements a dynamodb backed ingestion.Committer.
kre

Jump to

Keyboard shortcuts

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