Trait SimpleWalletBaseExt

Source
pub trait SimpleWalletBaseExt {
    // Required methods
    fn simple_wallet_base_initialize(
        &self,
        contract: Address,
        public_key: &[u8; 32],
        state: &mut VariableBytes,
    ) -> Result<(), ContractError>;
    fn simple_wallet_base_authorize(
        &self,
        contract: Address,
        state: &VariableBytes,
        header: &TransactionHeader,
        read_slots: &TxHandlerSlots,
        write_slots: &TxHandlerSlots,
        payload: &TxHandlerPayload,
        seal: &TxHandlerSeal,
    ) -> Result<(), ContractError>;
    fn simple_wallet_base_execute(
        &mut self,
        method_context: MethodContext,
        contract: Address,
        header: &TransactionHeader,
        read_slots: &TxHandlerSlots,
        write_slots: &TxHandlerSlots,
        payload: &TxHandlerPayload,
        seal: &TxHandlerSeal,
    ) -> Result<(), ContractError>;
    fn simple_wallet_base_increase_nonce(
        &self,
        contract: Address,
        state: &VariableBytes,
        seal: &TxHandlerSeal,
        new_state: &mut VariableBytes,
    ) -> Result<(), ContractError>;
    fn simple_wallet_base_change_public_key(
        &self,
        contract: Address,
        state: &VariableBytes,
        public_key: &[u8; 32],
        new_state: &mut VariableBytes,
    ) -> Result<(), ContractError>;
}
Expand description

Extension trait that provides helper methods for calling SimpleWalletBase’s methods on Env for convenience purposes

Required Methods§

Source

fn simple_wallet_base_initialize( &self, contract: Address, public_key: &[u8; 32], state: &mut VariableBytes, ) -> Result<(), ContractError>

Returns initial state with a provided public key

Source

fn simple_wallet_base_authorize( &self, contract: Address, state: &VariableBytes, header: &TransactionHeader, read_slots: &TxHandlerSlots, write_slots: &TxHandlerSlots, payload: &TxHandlerPayload, seal: &TxHandlerSeal, ) -> Result<(), ContractError>

Reads state of owner and returns Ok(()) if authorization succeeds

Source

fn simple_wallet_base_execute( &mut self, method_context: MethodContext, contract: Address, header: &TransactionHeader, read_slots: &TxHandlerSlots, write_slots: &TxHandlerSlots, payload: &TxHandlerPayload, seal: &TxHandlerSeal, ) -> Result<(), ContractError>

Executes provided transactions in the payload.

IMPORTANT:

  • must only be called with trusted input, for example, successful signature verification in SimpleWalletBase::authorize() implies transaction was seen and verified by the user
  • remember to also SimpleWalletBase::increase_nonce() afterward unless there is a very good reason not to (like when wallet was replaced with another implementation containing a different state)

The caller must set themselves as a context or else error will be returned.

Source

fn simple_wallet_base_increase_nonce( &self, contract: Address, state: &VariableBytes, seal: &TxHandlerSeal, new_state: &mut VariableBytes, ) -> Result<(), ContractError>

Returns state with increased nonce

Source

fn simple_wallet_base_change_public_key( &self, contract: Address, state: &VariableBytes, public_key: &[u8; 32], new_state: &mut VariableBytes, ) -> Result<(), ContractError>

Returns state with a changed public key

Implementations on Foreign Types§

Source§

impl SimpleWalletBaseExt for Env<'_>

Source§

fn simple_wallet_base_initialize( &self, contract: Address, public_key: &[u8; 32], state: &mut VariableBytes, ) -> Result<(), ContractError>

Source§

fn simple_wallet_base_authorize( &self, contract: Address, state: &VariableBytes, header: &TransactionHeader, read_slots: &TxHandlerSlots, write_slots: &TxHandlerSlots, payload: &TxHandlerPayload, seal: &TxHandlerSeal, ) -> Result<(), ContractError>

Source§

fn simple_wallet_base_execute( &mut self, method_context: MethodContext, contract: Address, header: &TransactionHeader, read_slots: &TxHandlerSlots, write_slots: &TxHandlerSlots, payload: &TxHandlerPayload, seal: &TxHandlerSeal, ) -> Result<(), ContractError>

Source§

fn simple_wallet_base_increase_nonce( &self, contract: Address, state: &VariableBytes, seal: &TxHandlerSeal, new_state: &mut VariableBytes, ) -> Result<(), ContractError>

Source§

fn simple_wallet_base_change_public_key( &self, contract: Address, state: &VariableBytes, public_key: &[u8; 32], new_state: &mut VariableBytes, ) -> Result<(), ContractError>

Implementors§