Skip to content

Cleanup SubmitIntent by removing update flows #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 9 additions & 33 deletions pkg/code/server/transaction/action_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,19 @@ type newFulfillmentMetadata struct {
disableActiveScheduling bool
}

// BaseActionHandler is a base interface for operation-specific action handlers
//
// Note: Action handlers should load all required state on initialization to
// avoid duplicated work across interface method calls.
type BaseActionHandler interface {
// GetServerParameter gets the server parameter for the action within the context
// of the intent.
GetServerParameter() *transactionpb.ServerParameter

// OnSaveToDB is a callback when the action is being saved 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.
OnSaveToDB(ctx context.Context) error
}

// CreateActionHandler is an interface for creating new actions
type CreateActionHandler interface {
BaseActionHandler

// 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.
Expand All @@ -81,22 +67,12 @@ type CreateActionHandler interface {
nonce *common.Account,
bh solana.Blockhash,
) (*newFulfillmentMetadata, error)
}

// UpgradeActionHandler is an interface for upgrading existing actions. It's
// assumed we'll only be upgrading a single fulfillment.
type UpgradeActionHandler interface {
BaseActionHandler

// GetFulfillmentBeingUpgraded gets the original fulfillment that's being
// upgraded.
GetFulfillmentBeingUpgraded() *fulfillment.Record

// GetFulfillmentMetadata gets upgraded fulfillment metadata
GetFulfillmentMetadata(
nonce *common.Account,
bh solana.Blockhash,
) (*newFulfillmentMetadata, error)
// OnSaveToDB is a callback when the action is being saved 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.
OnSaveToDB(ctx context.Context) error
}

type OpenAccountActionHandler struct {
Expand Down
Loading
Loading