-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft required TransactionService impl
- Loading branch information
1 parent
b36b6cd
commit 1becc15
Showing
2 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package services | ||
|
||
import ( | ||
"context" | ||
|
||
corecontext "cosmossdk.io/core/context" | ||
"cosmossdk.io/core/transaction" | ||
) | ||
|
||
var _ transaction.Service = &ContextAwareTransactionService{} | ||
|
||
// ContextAwareTransactionService implements the transaction.Service interface. | ||
// It is used to retrieve the execution mode in the context. | ||
type ContextAwareTransactionService struct{} | ||
|
||
// ExecMode returns the execution mode stored in the context. | ||
func (c ContextAwareTransactionService) ExecMode(ctx context.Context) transaction.ExecMode { | ||
return ctx.Value(corecontext.ExecModeKey).(transaction.ExecMode) | ||
} | ||
|
||
func NewContextAwareTransactionService() transaction.Service { | ||
return &ContextAwareTransactionService{} | ||
} |