Trait oasis_runtime_sdk::module::TransactionHandler
source · pub trait TransactionHandler {
// Provided methods
fn approve_raw_tx<C: Context>(_ctx: &C, _tx: &[u8]) -> Result<(), Error> { ... }
fn approve_unverified_tx<C: Context>(
_ctx: &C,
_utx: &UnverifiedTransaction,
) -> Result<(), Error> { ... }
fn decode_tx<C: Context>(
_ctx: &C,
_scheme: &str,
_body: &[u8],
) -> Result<Option<Transaction>, Error> { ... }
fn authenticate_tx<C: Context>(
_ctx: &C,
_tx: &Transaction,
) -> Result<AuthDecision, Error> { ... }
fn before_handle_call<C: Context>(
_ctx: &C,
_call: &Call,
) -> Result<(), Error> { ... }
fn before_authorized_call_dispatch<C: Context>(
_ctx: &C,
_call: &Call,
) -> Result<(), Error> { ... }
fn after_handle_call<C: Context>(
_ctx: &C,
result: CallResult,
) -> Result<CallResult, Error> { ... }
fn after_dispatch_tx<C: Context>(
_ctx: &C,
_tx_auth_info: &AuthInfo,
_result: &CallResult,
) { ... }
}
Expand description
Transaction handler.
Provided Methods§
sourcefn approve_raw_tx<C: Context>(_ctx: &C, _tx: &[u8]) -> Result<(), Error>
fn approve_raw_tx<C: Context>(_ctx: &C, _tx: &[u8]) -> Result<(), Error>
Judge if a raw transaction is good enough to undergo decoding. This takes place before even decoding the transaction.
sourcefn approve_unverified_tx<C: Context>(
_ctx: &C,
_utx: &UnverifiedTransaction,
) -> Result<(), Error>
fn approve_unverified_tx<C: Context>( _ctx: &C, _utx: &UnverifiedTransaction, ) -> Result<(), Error>
Judge if an unverified transaction is good enough to undergo verification. This takes place before even verifying signatures.
sourcefn decode_tx<C: Context>(
_ctx: &C,
_scheme: &str,
_body: &[u8],
) -> Result<Option<Transaction>, Error>
fn decode_tx<C: Context>( _ctx: &C, _scheme: &str, _body: &[u8], ) -> Result<Option<Transaction>, Error>
Decode a transaction that was sent with module-controlled decoding and verify any signatures.
Postcondition: if returning a Transaction, that transaction must pass validate_basic
.
Returns Ok(Some(_)) if the module is in charge of the encoding scheme identified by _scheme or Ok(None) otherwise.
sourcefn authenticate_tx<C: Context>(
_ctx: &C,
_tx: &Transaction,
) -> Result<AuthDecision, Error>
fn authenticate_tx<C: Context>( _ctx: &C, _tx: &Transaction, ) -> Result<AuthDecision, Error>
Authenticate a transaction.
Note that any signatures have already been verified.
sourcefn before_handle_call<C: Context>(_ctx: &C, _call: &Call) -> Result<(), Error>
fn before_handle_call<C: Context>(_ctx: &C, _call: &Call) -> Result<(), Error>
Perform any action after authentication, within the transaction context.
At this point call format has not yet been decoded so peeking into the call may not be possible in case the call is encrypted.
Perform any action after authentication and decoding, within the transaction context.
At this point, the call has been decoded according to the call format, and method authorizers have run.
sourcefn after_handle_call<C: Context>(
_ctx: &C,
result: CallResult,
) -> Result<CallResult, Error>
fn after_handle_call<C: Context>( _ctx: &C, result: CallResult, ) -> Result<CallResult, Error>
Perform any action after call, within the transaction context.
If an error is returned the transaction call fails and updates are rolled back.
sourcefn after_dispatch_tx<C: Context>(
_ctx: &C,
_tx_auth_info: &AuthInfo,
_result: &CallResult,
)
fn after_dispatch_tx<C: Context>( _ctx: &C, _tx_auth_info: &AuthInfo, _result: &CallResult, )
Perform any action after dispatching the transaction, in batch context.