Documentation
¶
Index ¶
- Constants
- Variables
- func GetAirdropIntentId(airdropType AirdropType, reference string) string
- func NewTransactionServer(data code_data.Provider, vmIndexerClient indexerpb.IndexerClient, ...) (transactionpb.TransactionServer, error)
- type AirdropIntegration
- type AirdropType
- type ConfigProvider
- type CreateActionHandler
- func NewFeePaymentActionHandler(ctx context.Context, data code_data.Provider, ...) (CreateActionHandler, error)
- func NewNoPrivacyTransferActionHandler(ctx context.Context, data code_data.Provider, ...) (CreateActionHandler, error)
- func NewNoPrivacyWithdrawActionHandler(ctx context.Context, data code_data.Provider, intentRecord *intent.Record, ...) (CreateActionHandler, error)
- func NewOpenAccountActionHandler(ctx context.Context, data code_data.Provider, ...) (CreateActionHandler, error)
- type CreateIntentHandler
- func NewOpenAccountsIntentHandler(conf *conf, data code_data.Provider, antispamGuard *antispam.Guard) CreateIntentHandler
- func NewPublicDistributionIntentHandler(conf *conf, data code_data.Provider, antispamGuard *antispam.Guard, ...) CreateIntentHandler
- func NewReceivePaymentsPubliclyIntentHandler(conf *conf, data code_data.Provider, antispamGuard *antispam.Guard, ...) CreateIntentHandler
- func NewSendPublicPaymentIntentHandler(conf *conf, data code_data.Provider, antispamGuard *antispam.Guard, ...) CreateIntentHandler
- type CurrencyCreatorBuySellSwapHandler
- type CurrencyCreatorBuySwapHandler
- type CurrencyCreatorSellSwapHandler
- type IntentDeniedError
- type IntentValidationError
- func NewActionValidationError(action *transactionpb.Action, message string) IntentValidationError
- func NewActionValidationErrorf(action *transactionpb.Action, message string, args ...any) IntentValidationError
- func NewIntentValidationError(message string) IntentValidationError
- func NewIntentValidationErrorf(format string, args ...any) IntentValidationError
- type LocalSimulationResult
- func (s LocalSimulationResult) CountFeePayments() int
- func (s LocalSimulationResult) GetClosedAccounts() []TokenAccountSimulation
- func (s LocalSimulationResult) GetFeePayments() []TransferSimulation
- func (s LocalSimulationResult) GetOpenedAccounts() []TokenAccountSimulation
- func (s LocalSimulationResult) HasAnyFeePayments() bool
- type NoPrivacyTransferActionHandler
- func (h *NoPrivacyTransferActionHandler) FulfillmentCount() int
- func (h *NoPrivacyTransferActionHandler) GetFulfillmentMetadata(index int, nonce *common.Account, bh solana.Blockhash) (*newFulfillmentMetadata, error)
- func (h *NoPrivacyTransferActionHandler) GetServerParameter() *transactionpb.ServerParameter
- func (h *NoPrivacyTransferActionHandler) OnCommitToDB(ctx context.Context) error
- func (h *NoPrivacyTransferActionHandler) PopulateMetadata(actionRecord *action.Record) error
- func (h *NoPrivacyTransferActionHandler) RequiresNonce(index int) (bool, *common.Account)
- type NoPrivacyWithdrawActionHandler
- func (h *NoPrivacyWithdrawActionHandler) FulfillmentCount() int
- func (h *NoPrivacyWithdrawActionHandler) GetFulfillmentMetadata(index int, nonce *common.Account, bh solana.Blockhash) (*newFulfillmentMetadata, error)
- func (h *NoPrivacyWithdrawActionHandler) GetServerParameter() *transactionpb.ServerParameter
- func (h *NoPrivacyWithdrawActionHandler) OnCommitToDB(ctx context.Context) error
- func (h *NoPrivacyWithdrawActionHandler) PopulateMetadata(actionRecord *action.Record) error
- func (h *NoPrivacyWithdrawActionHandler) RequiresNonce(index int) (bool, *common.Account)
- type OpenAccountActionHandler
- func (h *OpenAccountActionHandler) FulfillmentCount() int
- func (h *OpenAccountActionHandler) GetFulfillmentMetadata(index int, nonce *common.Account, bh solana.Blockhash) (*newFulfillmentMetadata, error)
- func (h *OpenAccountActionHandler) GetServerParameter() *transactionpb.ServerParameter
- func (h *OpenAccountActionHandler) OnCommitToDB(ctx context.Context) error
- func (h *OpenAccountActionHandler) PopulateMetadata(actionRecord *action.Record) error
- func (h *OpenAccountActionHandler) RequiresNonce(index int) (bool, *common.Account)
- type OpenAccountsIntentHandler
- func (h *OpenAccountsIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, ...) error
- func (h *OpenAccountsIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
- func (h *OpenAccountsIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, ...) ([]*intentBalanceLock, error)
- func (h *OpenAccountsIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, ...) (bool, error)
- func (h *OpenAccountsIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, ...) error
- type PublicDistributionIntentHandler
- func (h *PublicDistributionIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, ...) error
- func (h *PublicDistributionIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
- func (h *PublicDistributionIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, ...) ([]*intentBalanceLock, error)
- func (h *PublicDistributionIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, ...) (bool, error)
- func (h *PublicDistributionIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, ...) error
- type ReceivePaymentsPubliclyIntentHandler
- func (h *ReceivePaymentsPubliclyIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, ...) error
- func (h *ReceivePaymentsPubliclyIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
- func (h *ReceivePaymentsPubliclyIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, ...) ([]*intentBalanceLock, error)
- func (h *ReceivePaymentsPubliclyIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, ...) (bool, error)
- func (h *ReceivePaymentsPubliclyIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, ...) error
- type SendPublicPaymentIntentHandler
- func (h *SendPublicPaymentIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, ...) error
- func (h *SendPublicPaymentIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
- func (h *SendPublicPaymentIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, ...) ([]*intentBalanceLock, error)
- func (h *SendPublicPaymentIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, ...) (bool, error)
- func (h *SendPublicPaymentIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, ...) error
- type StaleStateError
- type SubmitIntentIntegration
- type SwapDeniedError
- type SwapHandler
- func NewCurrencyCreatorBuySellSwapHandler(data code_data.Provider, vmIndexerClient indexerpb.IndexerClient, ...) SwapHandler
- func NewCurrencyCreatorBuySwapHandler(data code_data.Provider, vmIndexerClient indexerpb.IndexerClient, ...) SwapHandler
- func NewCurrencyCreatorSellSwapHandler(data code_data.Provider, vmIndexerClient indexerpb.IndexerClient, ...) SwapHandler
- type SwapServerParameters
- type SwapValidationError
- type TokenAccountSimulation
- func (s TokenAccountSimulation) CountIncomingTransfers() int
- func (s TokenAccountSimulation) CountOutgoingTransfers() int
- func (s TokenAccountSimulation) CountPrivateTransfers() int
- func (s TokenAccountSimulation) CountPublicTransfers() int
- func (s TokenAccountSimulation) CountWithdrawals() int
- func (s TokenAccountSimulation) EnforceBalances(ctx context.Context, data code_data.Provider, currentBalance uint64) error
- func (s TokenAccountSimulation) GetAutoReturns() []TransferSimulation
- func (s TokenAccountSimulation) GetDeltaQuarks(includeAutoReturns bool) int64
- func (s TokenAccountSimulation) GetIncomingTransfers() []TransferSimulation
- func (s TokenAccountSimulation) GetOutgoingTransfers() []TransferSimulation
- func (s TokenAccountSimulation) GetPrivateTransfers() []TransferSimulation
- func (s TokenAccountSimulation) GetPublicTransfers() []TransferSimulation
- func (s TokenAccountSimulation) GetWithdraws() []TransferSimulation
- func (s TokenAccountSimulation) HasAnyPrivateTransfers() bool
- func (s TokenAccountSimulation) HasAnyPublicTransfers() bool
- func (s TokenAccountSimulation) HasAnyWithdraws() bool
- func (s TokenAccountSimulation) HasIncomingTransfer() bool
- func (s TokenAccountSimulation) HasOutgoingTransfer() bool
- func (s TokenAccountSimulation) RequiresBalanceCheck() bool
- func (s TokenAccountSimulation) RequiresBalanceFetch() bool
- type TransferSimulation
Constants ¶
View Source
const ( DisableSubmitIntentConfigEnvName = envConfigPrefix + "DISABLE_SUBMIT_INTENT" SubmitIntentTimeoutConfigEnvName = envConfigPrefix + "SUBMIT_INTENT_TIMEOUT" SwapTimeoutConfigEnvName = envConfigPrefix + "SWAP_TIMEOUT" ClientReceiveTimeoutConfigEnvName = envConfigPrefix + "CLIENT_RECEIVE_TIMEOUT" FeeCollectorOwnerPublicKeyConfigEnvName = envConfigPrefix + "FEE_COLLECTOR_OWNER_PUBLIC_KEY" CreateOnSendWithdrawalUsdFeeConfigEnvName = envConfigPrefix + "CREATE_ON_SEND_WITHDRAWAL_USD_FEE" EnableAirdropsConfigEnvName = envConfigPrefix + "ENABLE_AIRDROPS" AirdropperOwnerPublicKeyEnvName = envConfigPrefix + "AIRDROPPER_OWNER_PUBLIC_KEY" MaxAirdropUsdValueEnvName = envConfigPrefix + "MAX_AIRDROP_USD_VALUE" )
Variables ¶
View Source
var ( ErrInvalidAirdropTarget = errors.New("invalid airdrop target owner account") ErrInsufficientAirdropperBalance = errors.New("insufficient airdropper balance") ErrIneligibleForAirdrop = errors.New("user isn't eligible for airdrop") )
View Source
var ( ErrTimedOutReceivingRequest = errors.New("timed out receiving request") ErrTooManyPayments = NewIntentDeniedError("too many payments") ErrTransactionLimitExceeded = NewIntentDeniedError("dollar value exceeds limit") ErrSourceNotManagedByCode = NewIntentDeniedError("at least one source account is no longer managed by code") ErrDestinationNotManagedByCode = NewIntentDeniedError("a destination account is no longer managed by code") ErrInvalidSignature = errors.New("invalid signature provided") ErrMissingSignature = errors.New("at least one signature is missing") ErrTooManySignatures = errors.New("too many signatures provided") ErrNotImplemented = errors.New("feature not implemented") )
Functions ¶
func GetAirdropIntentId ¶
func GetAirdropIntentId(airdropType AirdropType, reference string) string
func NewTransactionServer ¶
func NewTransactionServer( data code_data.Provider, vmIndexerClient indexerpb.IndexerClient, submitIntentIntegration SubmitIntentIntegration, airdropIntegration AirdropIntegration, antispamGuard *antispam.Guard, amlGuard *aml.Guard, noncePools []*transaction.LocalNoncePool, configProvider ConfigProvider, ) (transactionpb.TransactionServer, error)
Types ¶
type AirdropIntegration ¶
type AirdropIntegration interface {
// GetWelcomeBonusAmount returns the amount that should be paid for the
// welcome bonus. Return 0 amount if the airdrop should not be sent.
GetWelcomeBonusAmount(ctx context.Context, owner *common.Account) (float64, currency_lib.Code, error)
}
func NewDefaultAirdropIntegration ¶
func NewDefaultAirdropIntegration() AirdropIntegration
NewDefaultAirdropIntegration retuns an AirdropIntegration that sends $1 USD to everyone
type AirdropType ¶
type AirdropType uint8
const ( AirdropTypeUnknown AirdropType = iota AirdropTypeOnboardingBonus AirdropTypeWelcomeBonus )
func (AirdropType) String ¶
func (t AirdropType) String() string
type ConfigProvider ¶
type ConfigProvider func() *conf
ConfigProvider defines how config values are pulled
func WithEnvConfigs ¶
func WithEnvConfigs() ConfigProvider
WithEnvConfigs returns configuration pulled from environment variables
type CreateActionHandler ¶
type CreateActionHandler interface {
// FulfillmentCount returns the total number of fulfillments that
// will be created for the action.
FulfillmentCount() int
// PopulateMetadata populates action metadata into the provided record
PopulateMetadata(actionRecord *action.Record) error
// GetServerParameter gets the server parameter for the action within the context
// of the intent.
GetServerParameter() *transactionpb.ServerParameter
// RequiresNonce determines whether a nonce should be acquired for the
// fulfillment being created. This should be true whenever a virtual
// instruction needs to be signed by the client. The VM where the action
// will take place is provided when the result is true.
RequiresNonce(fulfillmentIndex int) (bool, *common.Account)
// GetFulfillmentMetadata gets metadata for the fulfillment being created
GetFulfillmentMetadata(
index int,
nonce *common.Account,
bh solana.Blockhash,
) (*newFulfillmentMetadata, error)
// OnCommitToDB is a callback when the action is being committeds to the DB
// within the scope of a DB transaction. Additional supporting DB records
// (ie. not the action or fulfillment records) relevant to the action should
// be saved here.
OnCommitToDB(ctx context.Context) error
}
CreateActionHandler is an interface for creating new actions
func NewFeePaymentActionHandler ¶
func NewFeePaymentActionHandler(ctx context.Context, data code_data.Provider, protoAction *transactionpb.FeePaymentAction, feeCollectorOwner *common.Account) (CreateActionHandler, error)
func NewNoPrivacyTransferActionHandler ¶
func NewNoPrivacyTransferActionHandler(ctx context.Context, data code_data.Provider, protoAction *transactionpb.NoPrivacyTransferAction) (CreateActionHandler, error)
func NewNoPrivacyWithdrawActionHandler ¶
func NewNoPrivacyWithdrawActionHandler(ctx context.Context, data code_data.Provider, intentRecord *intent.Record, protoAction *transactionpb.NoPrivacyWithdrawAction) (CreateActionHandler, error)
func NewOpenAccountActionHandler ¶
func NewOpenAccountActionHandler(ctx context.Context, data code_data.Provider, protoAction *transactionpb.OpenAccountAction, protoMetadata *transactionpb.Metadata) (CreateActionHandler, error)
type CreateIntentHandler ¶
type CreateIntentHandler interface {
// PopulateMetadata adds intent metadata to the provided intent record
// using the client-provided protobuf variant. No other fields in the
// intent should be modified.
//
// Intent-level validation errors may be returned here if caught early.
PopulateMetadata(ctx context.Context, intentRecord *intent.Record, protoMetadata *transactionpb.Metadata) error
// CreatesNewUser returns whether the intent creates a new Code user identified
// via a new owner account
CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
// IsNoop determines whether the intent is a no-op operation. SubmitIntent will
// simply return OK and stop any further intent processing.
//
// Note: This occurs before validation, so if anything appears out-of-order, then
// the recommendation is to return false and have the verification logic catch the
// error.
IsNoop(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) (bool, error)
// GetBalanceLocks gets a set of global balance locks to prevent race conditions
// against invalid balance updates that would result in intent fulfillment failure
GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata) ([]*intentBalanceLock, error)
// AllowCreation determines whether the new intent creation should be allowed.
AllowCreation(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) error
}
CreateIntentHandler is an interface for handling new intent creations
func NewOpenAccountsIntentHandler ¶
func NewOpenAccountsIntentHandler(conf *conf, data code_data.Provider, antispamGuard *antispam.Guard) CreateIntentHandler
type CurrencyCreatorBuySellSwapHandler ¶
type CurrencyCreatorBuySellSwapHandler struct {
// contains filtered or unexported fields
}
func (*CurrencyCreatorBuySellSwapHandler) GetServerParameters ¶
func (h *CurrencyCreatorBuySellSwapHandler) GetServerParameters() *SwapServerParameters
func (*CurrencyCreatorBuySellSwapHandler) MakeInstructions ¶
func (h *CurrencyCreatorBuySellSwapHandler) MakeInstructions(ctx context.Context) ([]solana.Instruction, error)
type CurrencyCreatorBuySwapHandler ¶
type CurrencyCreatorBuySwapHandler struct {
// contains filtered or unexported fields
}
func (*CurrencyCreatorBuySwapHandler) GetServerParameters ¶
func (h *CurrencyCreatorBuySwapHandler) GetServerParameters() *SwapServerParameters
func (*CurrencyCreatorBuySwapHandler) MakeInstructions ¶
func (h *CurrencyCreatorBuySwapHandler) MakeInstructions(ctx context.Context) ([]solana.Instruction, error)
type CurrencyCreatorSellSwapHandler ¶
type CurrencyCreatorSellSwapHandler struct {
// contains filtered or unexported fields
}
func (*CurrencyCreatorSellSwapHandler) GetServerParameters ¶
func (h *CurrencyCreatorSellSwapHandler) GetServerParameters() *SwapServerParameters
func (*CurrencyCreatorSellSwapHandler) MakeInstructions ¶
func (h *CurrencyCreatorSellSwapHandler) MakeInstructions(ctx context.Context) ([]solana.Instruction, error)
type IntentDeniedError ¶
type IntentDeniedError struct {
// contains filtered or unexported fields
}
func NewIntentDeniedError ¶
func NewIntentDeniedError(message string) IntentDeniedError
func (IntentDeniedError) Error ¶
func (e IntentDeniedError) Error() string
type IntentValidationError ¶
type IntentValidationError struct {
// contains filtered or unexported fields
}
func NewActionValidationError ¶
func NewActionValidationError(action *transactionpb.Action, message string) IntentValidationError
func NewActionValidationErrorf ¶
func NewActionValidationErrorf(action *transactionpb.Action, message string, args ...any) IntentValidationError
func NewIntentValidationError ¶
func NewIntentValidationError(message string) IntentValidationError
func NewIntentValidationErrorf ¶
func NewIntentValidationErrorf(format string, args ...any) IntentValidationError
func (IntentValidationError) Error ¶
func (e IntentValidationError) Error() string
type LocalSimulationResult ¶
type LocalSimulationResult struct {
SimulationsByAccount map[string]TokenAccountSimulation
}
func LocalSimulation ¶
func LocalSimulation(ctx context.Context, data code_data.Provider, actions []*transactionpb.Action) (*LocalSimulationResult, error)
LocalSimulation simulates actions as if they were executed on the blockchain taking into account cached Code DB state. External state is not considered and must be validated elsewhere.
func (LocalSimulationResult) CountFeePayments ¶
func (s LocalSimulationResult) CountFeePayments() int
func (LocalSimulationResult) GetClosedAccounts ¶
func (s LocalSimulationResult) GetClosedAccounts() []TokenAccountSimulation
func (LocalSimulationResult) GetFeePayments ¶
func (s LocalSimulationResult) GetFeePayments() []TransferSimulation
func (LocalSimulationResult) GetOpenedAccounts ¶
func (s LocalSimulationResult) GetOpenedAccounts() []TokenAccountSimulation
func (LocalSimulationResult) HasAnyFeePayments ¶
func (s LocalSimulationResult) HasAnyFeePayments() bool
type NoPrivacyTransferActionHandler ¶
type NoPrivacyTransferActionHandler struct {
// contains filtered or unexported fields
}
func (*NoPrivacyTransferActionHandler) FulfillmentCount ¶
func (h *NoPrivacyTransferActionHandler) FulfillmentCount() int
func (*NoPrivacyTransferActionHandler) GetFulfillmentMetadata ¶
func (*NoPrivacyTransferActionHandler) GetServerParameter ¶
func (h *NoPrivacyTransferActionHandler) GetServerParameter() *transactionpb.ServerParameter
func (*NoPrivacyTransferActionHandler) OnCommitToDB ¶
func (h *NoPrivacyTransferActionHandler) OnCommitToDB(ctx context.Context) error
func (*NoPrivacyTransferActionHandler) PopulateMetadata ¶
func (h *NoPrivacyTransferActionHandler) PopulateMetadata(actionRecord *action.Record) error
func (*NoPrivacyTransferActionHandler) RequiresNonce ¶
func (h *NoPrivacyTransferActionHandler) RequiresNonce(index int) (bool, *common.Account)
type NoPrivacyWithdrawActionHandler ¶
type NoPrivacyWithdrawActionHandler struct {
// contains filtered or unexported fields
}
func (*NoPrivacyWithdrawActionHandler) FulfillmentCount ¶
func (h *NoPrivacyWithdrawActionHandler) FulfillmentCount() int
func (*NoPrivacyWithdrawActionHandler) GetFulfillmentMetadata ¶
func (*NoPrivacyWithdrawActionHandler) GetServerParameter ¶
func (h *NoPrivacyWithdrawActionHandler) GetServerParameter() *transactionpb.ServerParameter
func (*NoPrivacyWithdrawActionHandler) OnCommitToDB ¶
func (h *NoPrivacyWithdrawActionHandler) OnCommitToDB(ctx context.Context) error
func (*NoPrivacyWithdrawActionHandler) PopulateMetadata ¶
func (h *NoPrivacyWithdrawActionHandler) PopulateMetadata(actionRecord *action.Record) error
func (*NoPrivacyWithdrawActionHandler) RequiresNonce ¶
func (h *NoPrivacyWithdrawActionHandler) RequiresNonce(index int) (bool, *common.Account)
type OpenAccountActionHandler ¶
type OpenAccountActionHandler struct {
// contains filtered or unexported fields
}
func (*OpenAccountActionHandler) FulfillmentCount ¶
func (h *OpenAccountActionHandler) FulfillmentCount() int
func (*OpenAccountActionHandler) GetFulfillmentMetadata ¶
func (*OpenAccountActionHandler) GetServerParameter ¶
func (h *OpenAccountActionHandler) GetServerParameter() *transactionpb.ServerParameter
func (*OpenAccountActionHandler) OnCommitToDB ¶
func (h *OpenAccountActionHandler) OnCommitToDB(ctx context.Context) error
func (*OpenAccountActionHandler) PopulateMetadata ¶
func (h *OpenAccountActionHandler) PopulateMetadata(actionRecord *action.Record) error
func (*OpenAccountActionHandler) RequiresNonce ¶
func (h *OpenAccountActionHandler) RequiresNonce(index int) (bool, *common.Account)
type OpenAccountsIntentHandler ¶
type OpenAccountsIntentHandler struct {
// contains filtered or unexported fields
}
func (*OpenAccountsIntentHandler) AllowCreation ¶
func (h *OpenAccountsIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) error
func (*OpenAccountsIntentHandler) CreatesNewUser ¶
func (h *OpenAccountsIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
func (*OpenAccountsIntentHandler) GetBalanceLocks ¶
func (h *OpenAccountsIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata) ([]*intentBalanceLock, error)
func (*OpenAccountsIntentHandler) IsNoop ¶
func (h *OpenAccountsIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) (bool, error)
func (*OpenAccountsIntentHandler) PopulateMetadata ¶
func (h *OpenAccountsIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, protoMetadata *transactionpb.Metadata) error
type PublicDistributionIntentHandler ¶
type PublicDistributionIntentHandler struct {
// contains filtered or unexported fields
}
func (*PublicDistributionIntentHandler) AllowCreation ¶
func (h *PublicDistributionIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, untypedMetadata *transactionpb.Metadata, actions []*transactionpb.Action) error
todo: Not all multi-mint validation checks are implemented
func (*PublicDistributionIntentHandler) CreatesNewUser ¶
func (h *PublicDistributionIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
func (*PublicDistributionIntentHandler) GetBalanceLocks ¶
func (h *PublicDistributionIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata) ([]*intentBalanceLock, error)
func (*PublicDistributionIntentHandler) IsNoop ¶
func (h *PublicDistributionIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) (bool, error)
func (*PublicDistributionIntentHandler) PopulateMetadata ¶
func (h *PublicDistributionIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, protoMetadata *transactionpb.Metadata) error
type ReceivePaymentsPubliclyIntentHandler ¶
type ReceivePaymentsPubliclyIntentHandler struct {
// contains filtered or unexported fields
}
func (*ReceivePaymentsPubliclyIntentHandler) AllowCreation ¶
func (h *ReceivePaymentsPubliclyIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, untypedMetadata *transactionpb.Metadata, actions []*transactionpb.Action) error
func (*ReceivePaymentsPubliclyIntentHandler) CreatesNewUser ¶
func (h *ReceivePaymentsPubliclyIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
func (*ReceivePaymentsPubliclyIntentHandler) GetBalanceLocks ¶
func (h *ReceivePaymentsPubliclyIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata) ([]*intentBalanceLock, error)
func (*ReceivePaymentsPubliclyIntentHandler) IsNoop ¶
func (h *ReceivePaymentsPubliclyIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) (bool, error)
func (*ReceivePaymentsPubliclyIntentHandler) PopulateMetadata ¶
func (h *ReceivePaymentsPubliclyIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, protoMetadata *transactionpb.Metadata) error
type SendPublicPaymentIntentHandler ¶
type SendPublicPaymentIntentHandler struct {
// contains filtered or unexported fields
}
func (*SendPublicPaymentIntentHandler) AllowCreation ¶
func (h *SendPublicPaymentIntentHandler) AllowCreation(ctx context.Context, intentRecord *intent.Record, untypedMetadata *transactionpb.Metadata, actions []*transactionpb.Action) error
func (*SendPublicPaymentIntentHandler) CreatesNewUser ¶
func (h *SendPublicPaymentIntentHandler) CreatesNewUser(ctx context.Context, metadata *transactionpb.Metadata) (bool, error)
func (*SendPublicPaymentIntentHandler) GetBalanceLocks ¶
func (h *SendPublicPaymentIntentHandler) GetBalanceLocks(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata) ([]*intentBalanceLock, error)
func (*SendPublicPaymentIntentHandler) IsNoop ¶
func (h *SendPublicPaymentIntentHandler) IsNoop(ctx context.Context, intentRecord *intent.Record, metadata *transactionpb.Metadata, actions []*transactionpb.Action) (bool, error)
func (*SendPublicPaymentIntentHandler) PopulateMetadata ¶
func (h *SendPublicPaymentIntentHandler) PopulateMetadata(ctx context.Context, intentRecord *intent.Record, protoMetadata *transactionpb.Metadata) error
type StaleStateError ¶
type StaleStateError struct {
// contains filtered or unexported fields
}
func NewActionWithStaleStateError ¶
func NewActionWithStaleStateError(action *transactionpb.Action, message string) StaleStateError
func NewStaleStateError ¶
func NewStaleStateError(message string) StaleStateError
func NewStaleStateErrorf ¶
func NewStaleStateErrorf(format string, args ...any) StaleStateError
func (StaleStateError) Error ¶
func (e StaleStateError) Error() string
type SubmitIntentIntegration ¶
type SubmitIntentIntegration 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
// OnSuccess is a best-effort callback when an intent has been successfully
// submitted
OnSuccess(ctx context.Context, intentRecord *intent.Record) error
}
func NewDefaultSubmitIntentIntegration ¶
func NewDefaultSubmitIntentIntegration() SubmitIntentIntegration
NewDefaultSubmitIntentIntegration retuns a SubmitIntentIntegration that allows everything
type SwapDeniedError ¶
type SwapDeniedError struct {
// contains filtered or unexported fields
}
func NewSwapDeniedError ¶
func NewSwapDeniedError(message string) SwapDeniedError
func NewSwapDeniedErrorf ¶
func NewSwapDeniedErrorf(format string, args ...any) SwapDeniedError
func (SwapDeniedError) Error ¶
func (e SwapDeniedError) Error() string
type SwapHandler ¶
type SwapHandler interface {
// GetServerParameter gets the server parameters to return to client for the swap
GetServerParameters() *SwapServerParameters
// MakeInstructions makes the Solana transaction instructions to perform the swap
MakeInstructions(ctx context.Context) ([]solana.Instruction, error)
}
type SwapServerParameters ¶
type SwapValidationError ¶
type SwapValidationError struct {
// contains filtered or unexported fields
}
func NewSwapValidationError ¶
func NewSwapValidationError(message string) SwapValidationError
func NewSwapValidationErrorf ¶
func NewSwapValidationErrorf(format string, args ...any) SwapValidationError
func (SwapValidationError) Error ¶
func (e SwapValidationError) Error() string
type TokenAccountSimulation ¶
type TokenAccountSimulation struct {
TokenAccount *common.Account
MintAccount *common.Account
Transfers []TransferSimulation
Opened bool
OpenAction *transactionpb.Action
Closed bool
CloseAction *transactionpb.Action
IsAutoReturned bool
}
func FilterAutoReturnedAccounts ¶
func FilterAutoReturnedAccounts(in []TokenAccountSimulation) []TokenAccountSimulation
func (TokenAccountSimulation) CountIncomingTransfers ¶
func (s TokenAccountSimulation) CountIncomingTransfers() int
func (TokenAccountSimulation) CountOutgoingTransfers ¶
func (s TokenAccountSimulation) CountOutgoingTransfers() int
func (TokenAccountSimulation) CountPrivateTransfers ¶
func (s TokenAccountSimulation) CountPrivateTransfers() int
func (TokenAccountSimulation) CountPublicTransfers ¶
func (s TokenAccountSimulation) CountPublicTransfers() int
func (TokenAccountSimulation) CountWithdrawals ¶
func (s TokenAccountSimulation) CountWithdrawals() int
func (TokenAccountSimulation) EnforceBalances ¶
func (TokenAccountSimulation) GetAutoReturns ¶
func (s TokenAccountSimulation) GetAutoReturns() []TransferSimulation
func (TokenAccountSimulation) GetDeltaQuarks ¶
func (s TokenAccountSimulation) GetDeltaQuarks(includeAutoReturns bool) int64
func (TokenAccountSimulation) GetIncomingTransfers ¶
func (s TokenAccountSimulation) GetIncomingTransfers() []TransferSimulation
func (TokenAccountSimulation) GetOutgoingTransfers ¶
func (s TokenAccountSimulation) GetOutgoingTransfers() []TransferSimulation
func (TokenAccountSimulation) GetPrivateTransfers ¶
func (s TokenAccountSimulation) GetPrivateTransfers() []TransferSimulation
func (TokenAccountSimulation) GetPublicTransfers ¶
func (s TokenAccountSimulation) GetPublicTransfers() []TransferSimulation
func (TokenAccountSimulation) GetWithdraws ¶
func (s TokenAccountSimulation) GetWithdraws() []TransferSimulation
func (TokenAccountSimulation) HasAnyPrivateTransfers ¶
func (s TokenAccountSimulation) HasAnyPrivateTransfers() bool
func (TokenAccountSimulation) HasAnyPublicTransfers ¶
func (s TokenAccountSimulation) HasAnyPublicTransfers() bool
func (TokenAccountSimulation) HasAnyWithdraws ¶
func (s TokenAccountSimulation) HasAnyWithdraws() bool
func (TokenAccountSimulation) HasIncomingTransfer ¶
func (s TokenAccountSimulation) HasIncomingTransfer() bool
func (TokenAccountSimulation) HasOutgoingTransfer ¶
func (s TokenAccountSimulation) HasOutgoingTransfer() bool
func (TokenAccountSimulation) RequiresBalanceCheck ¶
func (s TokenAccountSimulation) RequiresBalanceCheck() bool
func (TokenAccountSimulation) RequiresBalanceFetch ¶
func (s TokenAccountSimulation) RequiresBalanceFetch() bool
type TransferSimulation ¶
type TransferSimulation struct {
Action *transactionpb.Action
IsPrivate bool
IsWithdraw bool
IsFee bool
IsAutoReturn bool
DeltaQuarks int64
}
func FilterAutoReturnTransfers ¶
func FilterAutoReturnTransfers(in []TransferSimulation) []TransferSimulation
Click to show internal directories.
Click to hide internal directories.