intent

package
v1.10.21-0...-113a02c Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIntentNotFound       = errors.New("no records could be found")
	ErrMultilpeIntentsFound = errors.New("multiple records found")
	ErrStaleVersion         = errors.New("intent version is stale")
)

Functions

This section is empty.

Types

type Distribution

type Distribution struct {
	DestinationOwnerAccount string
	DestinationTokenAccount string
	Quantity                uint64
}

func (*Distribution) Clone

func (m *Distribution) Clone() Distribution

func (*Distribution) CopyTo

func (m *Distribution) CopyTo(dst *Distribution)

func (*Distribution) Validate

func (m *Distribution) Validate() error

type ExternalDepositMetadata

type ExternalDepositMetadata struct {
	DestinationTokenAccount string
	Quantity                uint64
	UsdMarketValue          float64
}

func (*ExternalDepositMetadata) Clone

func (*ExternalDepositMetadata) CopyTo

func (*ExternalDepositMetadata) Validate

func (m *ExternalDepositMetadata) Validate() error

type OpenAccountsMetadata

type OpenAccountsMetadata struct {
}

func (*OpenAccountsMetadata) Clone

func (*OpenAccountsMetadata) CopyTo

func (*OpenAccountsMetadata) Validate

func (m *OpenAccountsMetadata) Validate() error

type PublicDistributionMetadata

type PublicDistributionMetadata struct {
	Source         string
	Distributions  []*Distribution
	Quantity       uint64
	UsdMarketValue float64
}

func (*PublicDistributionMetadata) Clone

func (*PublicDistributionMetadata) CopyTo

func (*PublicDistributionMetadata) Validate

func (m *PublicDistributionMetadata) Validate() error

type ReceivePaymentsPubliclyMetadata

type ReceivePaymentsPubliclyMetadata struct {
	Source   string
	Quantity uint64

	IsRemoteSend            bool
	IsReturned              bool
	IsIssuerVoidingGiftCard bool

	OriginalExchangeCurrency currency.Code
	OriginalExchangeRate     float64
	OriginalNativeAmount     float64

	UsdMarketValue float64
}

func (*ReceivePaymentsPubliclyMetadata) Clone

func (*ReceivePaymentsPubliclyMetadata) CopyTo

func (*ReceivePaymentsPubliclyMetadata) Validate

func (m *ReceivePaymentsPubliclyMetadata) Validate() error

type Record

type Record struct {
	Id uint64

	IntentId   string
	IntentType Type

	MintAccount string

	InitiatorOwnerAccount string

	OpenAccountsMetadata            *OpenAccountsMetadata
	ExternalDepositMetadata         *ExternalDepositMetadata
	SendPublicPaymentMetadata       *SendPublicPaymentMetadata
	ReceivePaymentsPubliclyMetadata *ReceivePaymentsPubliclyMetadata
	PublicDistributionMetadata      *PublicDistributionMetadata

	State State

	Version uint64

	CreatedAt time.Time
}

func (*Record) Clone

func (r *Record) Clone() Record

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) IsCompleted

func (r *Record) IsCompleted() bool

func (*Record) Validate

func (r *Record) Validate() error

type SendPublicPaymentMetadata

type SendPublicPaymentMetadata struct {
	DestinationOwnerAccount string
	DestinationTokenAccount string
	Quantity                uint64

	ExchangeCurrency currency.Code
	ExchangeRate     float64
	NativeAmount     float64
	UsdMarketValue   float64

	IsWithdrawal bool
	IsRemoteSend bool
}

func (*SendPublicPaymentMetadata) Clone

func (*SendPublicPaymentMetadata) CopyTo

func (*SendPublicPaymentMetadata) Validate

func (m *SendPublicPaymentMetadata) Validate() error

type State

type State uint8
const (
	StateUnknown State = iota
	StatePending
	StateConfirmed
	StateFailed
	StateRevoked
)

func (State) IsTerminal

func (s State) IsTerminal() bool

func (State) String

func (s State) String() string

type Store

type Store interface {
	// Save creates or updates an intent on the store.
	Save(ctx context.Context, record *Record) error

	// Get finds the intent record for a given intent ID.
	//
	// Returns ErrNotFound if no record is found.
	Get(ctx context.Context, intentID string) (*Record, error)

	// GetAllByOwner returns all records for a given owner (as both a source and destination).
	//
	// Returns ErrNotFound if no records are found.
	GetAllByOwner(ctx context.Context, owner string, cursor query.Cursor, limit uint64, direction query.Ordering) ([]*Record, error)

	// GetOriginalGiftCardIssuedIntent gets the original intent where a gift card
	// was issued by its vault address.
	GetOriginalGiftCardIssuedIntent(ctx context.Context, giftCardVault string) (*Record, error)

	// GetGiftCardClaimedIntent gets the intent where a gift card was claimed by its
	// vault address.
	GetGiftCardClaimedIntent(ctx context.Context, giftCardVault string) (*Record, error)

	// GetTransactedAmountForAntiMoneyLaundering gets the total transacted core mint quarks and the
	// corresponding USD market value for an owner since a timestamp.
	GetTransactedAmountForAntiMoneyLaundering(ctx context.Context, owner string, since time.Time) (uint64, float64, error)
}

type Type

type Type uint8
const (
	UnknownType         Type = iota
	LegacyPayment            // Deprecated pre-2022 privacy flow
	LegacyCreateAccount      // Deprecated pre-2022 privacy flow
	OpenAccounts
	SendPrivatePayment       // Deprecated privacy flow
	ReceivePaymentsPrivately // Deprecated privacy flow
	SaveRecentRoot           // Deprecated privacy flow
	MigrateToPrivacy2022     // Deprecated privacy flow
	ExternalDeposit
	SendPublicPayment
	ReceivePaymentsPublicly
	EstablishRelationship // Deprecated privacy flow
	Login                 // Deprecated login flow
	PublicDistribution
)

func (Type) String

func (t Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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