InfiniRewards
Reference

Account Contracts

Reference documentation for the InfiniRewards account contracts

Account Contracts

InfiniRewards uses specialized account contracts to provide enhanced functionality for different user types.

InfiniRewardsMerchantAccount

A specialized account contract for merchant businesses with enhanced capabilities.

Storage Variables

NameTypeDescription
public_keyfelt252Public key of the merchant
points_contractsVec<ContractAddress>List of points contracts owned by this merchant
collectible_contractsVec<ContractAddress>List of collectible contracts owned by this merchant
authorized_sessionsMap<felt252, SessionKey>Authorized session keys
transaction_noncefelt252Current nonce for transaction ordering

Key Methods

Execute Transaction

fn execute_transaction(
    ref self: ContractState,
    call_array: Array<Call>,
    signature: Array<felt252>
) -> Array<Span<felt252>>

Executes a batch of transactions after validating the signature.

ParameterTypeDescription
call_arrayArray<Call>Array of calls to execute
signatureArray<felt252>Signature authorizing the calls

Returns: Array of results from the calls

Create Session Key

fn create_session_key(
    ref self: ContractState,
    session_key: felt252,
    expiry: u64,
    permitted_calls: Array<PermittedCall>
) -> felt252

Creates a session key with limited permissions.

ParameterTypeDescription
session_keyfelt252Public key for the session
expiryu64Timestamp when this key expires
permitted_callsArray<PermittedCall>Calls this key is authorized to make

Returns: Session key ID

InfiniRewardsUserAccount

A specialized account contract for individual users with loyalty features.

Storage Variables

NameTypeDescription
public_keyfelt252Public key of the user
transaction_noncefelt252Current nonce for transaction ordering
authorized_sessionsMap<felt252, SessionKey>Authorized session keys
guardiansVec<ContractAddress>List of guardian addresses for account recovery
recovery_mode_activeboolWhether recovery mode is currently active

Key Methods

Execute Transaction

fn execute_transaction(
    ref self: ContractState,
    call_array: Array<Call>,
    signature: Array<felt252>
) -> Array<Span<felt252>>

Executes a batch of transactions after validating the signature.

ParameterTypeDescription
call_arrayArray<Call>Array of calls to execute
signatureArray<felt252>Signature authorizing the calls

Returns: Array of results from the calls

Add Guardian

fn add_guardian(
    ref self: ContractState,
    guardian: ContractAddress
)

Adds a guardian for account recovery.

ParameterTypeDescription
guardianContractAddressAddress of the guardian to add

Initiate Recovery

fn initiate_recovery(
    ref self: ContractState,
    guardian: ContractAddress,
    new_public_key: felt252,
    guardian_signature: Array<felt252>
)

Initiates account recovery process.

ParameterTypeDescription
guardianContractAddressAddress of the guardian initiating recovery
new_public_keyfelt252New public key to set
guardian_signatureArray<felt252>Signature from the guardian

On this page