integration

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Antispam

type Antispam interface {
	AllowOpenAccounts(ctx context.Context, owner *common.Account, accountSet transactionpb.OpenAccountsMetadata_AccountSet) (bool, string, error)

	AllowSendPayment(ctx context.Context, owner, destination *common.Account, isPublic bool) (bool, string, error)

	AllowReceivePayments(ctx context.Context, owner *common.Account, isPublic bool) (bool, string, error)

	AllowDistribution(ctx context.Context, owner *common.Account, isPublic bool) (bool, string, error)

	AllowSwap(ctx context.Context, kind swap.Kind, fundingSource swap.FundingSource, owner, fromMint, toMint *common.Account, swapAmount, feeAmount uint64, initializesMint bool) (bool, string, error)

	AllowCurrencyLaunch(ctx context.Context, owner *common.Account, name, symbol string) (bool, string, error)
}

Antispam is an antispam guard integration that apps can implement to check whether operations of interest are allowed to be performed.

func NewAllowEverythingAntispamIntegration

func NewAllowEverythingAntispamIntegration() Antispam

NewAllowEverythingAntispamIntegration returns a default antispam integration that allows everything

type Geyser

type Geyser interface {
	// OnDepositReceived allows for notifications for external deposits processed by Geyser
	OnDepositReceived(ctx context.Context, owner, mint *common.Account, currencyName string, usdMarketValue float64) error
}

Swap is an integration that hooks into the Geyser worker

type ModeratedContentKind added in v1.30.0

type ModeratedContentKind uint8

ModeratedContentKind is what a piece of moderated content is used as. OCP names it at each call site from the field being validated, never from the client, so an integration can require that the content was moderated as exactly that kind: content moderated under a looser kind's checks (e.g. a description's) must not pass as one with stricter checks (e.g. a name's).

const (
	ModeratedContentKindUnknown ModeratedContentKind = iota
	ModeratedContentKindCurrencyName
	ModeratedContentKindCurrencySymbol
	ModeratedContentKindCurrencyDescription
	ModeratedContentKindCurrencyIcon
)

func (ModeratedContentKind) String added in v1.30.0

func (k ModeratedContentKind) String() string

type Moderation

type Moderation interface {
	// ValidateAttestation validates a moderation attestation for a piece of
	// moderated content used as the given kind. An integration should refuse an
	// attestation for content moderated as a different kind, and a kind it does
	// not know.
	ValidateAttestation(ctx context.Context, owner *common.Account, rawAttestation []byte, kind ModeratedContentKind, content any) (bool, error)
}

Moderation is an OCP integration enabling custom moderation rules

func NewAllowEverythingModerationIntegration

func NewAllowEverythingModerationIntegration() Moderation

NewAllowEverythingModerationIntegration returns a default Moderation integration that allows everything

type SubmitIntent

type SubmitIntent interface {
	// AllowCreation determines whether the new intent creation should be allowed
	// with app-specific validation rules
	AllowCreation(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) error

	// GetTasksToSchedule returns app-defined tasks whose execution is
	// guaranteed once the intent is committed. Returned tasks are persisted in
	// the same DB transaction that commits the intent, so an error fails the
	// whole submission and no tasks are scheduled.
	//
	// Execution is delegated to the app's TaskExecutor and is at-least-once: a
	// best-effort attempt is made immediately after commit, with the background
	// worker retrying anything that fails. The same task may therefore execute
	// more than once and concurrently, so the TaskExecutor must be idempotent.
	GetTasksToSchedule(ctx context.Context, intentRecord *intent.Record) ([]*task.Record, error)

	// OnSuccess is a best-effort callback when an intent has been successfully
	// submitted
	OnSuccess(ctx context.Context, intentRecord *intent.Record) error
}

SubmitIntent is an integration that hooks into SubmitIntent

func NewDefaultSubmitIntentIntegration

func NewDefaultSubmitIntentIntegration() SubmitIntent

NewDefaultSubmitIntentIntegration retuns a SubmitIntentIntegration that allows everything

type Swap

type Swap interface {
	// OnSwapSubmitted allows for notification when the swap for when a swap is submitted
	OnSwapSubmitted(ctx context.Context, owner *common.Account, fromMint, toMint *common.Account, amount uint64) error

	// OnSwapFinalized allows for notifications based on events processed by the swap worker
	OnSwapFinalized(ctx context.Context, owner *common.Account, isBuy bool, mint *common.Account, currencyName string, region currency.Code, valueReceived float64) error
}

Swap is an integration that hooks into the swap worker

type TaskExecutor added in v1.18.0

type TaskExecutor interface {
	Execute(ctx context.Context, record *task.Record) error
}

TaskExecutor executes app-defined tasks whose execution is guaranteed by the base system.

Implementations must be idempotent. Tasks are delivered at-least-once and may be executed concurrently, in any order, by any number of processes. The task ID is a natural deduplication key.

A returned error means the task will be retried at a later time, until a maximum attempt count is reached.

func NewDefaultTaskExecutor added in v1.18.0

func NewDefaultTaskExecutor() TaskExecutor

NewDefaultTaskExecutor returns a TaskExecutor that fails every task, so orphaned tasks are surfaced loudly instead of being silently confirmed.

Jump to

Keyboard shortcuts

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