Refactoring and documentation

Status
In progress
Assign
Pradhumna Pancholi
type
House Cleaning
effort points
10
Start Date
Jun 14, 2022
End Date
priority
high
tags
Dev Workflow
Github PR
As we are moving towards more mature and stable product. Some parts of theme-extenion-app needs significant refactor e.g. : token ABI, global variables, etc. Also, adding some robust documentation to make it more readable and easy to understand.
This will also get rid of some duplicated lines of code and help with enforcing better error handling. In addition to this, it will make unit testing easier.
 
  1. connectWallet - Make global variables for provider, signer, and user address to be easily accessible.
  1. processTransaction
    1. Get rid of accessing wallet variables from provider and use global variable
    2. Refactor nested verification for network
    3. Implement generic method to lead email screen and verification.
  1. performTransaction
    1. Create generic ABI for all three tokens (all ERC-20 tokens)
    2. Refactor repeated transfer call
    3. Refactor nested if - else
  1. getShopAddr - Update then with async await
  1. getCartData - Update then with async await
  1. loadEmailScreen - Implement a generic function and can load the email screen. It is a big chunk of code repeated inside redeem and processTransaction as state management and email validation was time consuming and had some blockers when NFT redemption was initially shipped.
  1. validateEmail - Regular expression to validate email is repeated and nested inside email screen logic. It needs to be a generic pure function for a cleaner implementation.
  1. redeem
    1. Get rid of repeated wallet verification
    2. Implemented generic function to load and validate email screen.

Refactoring and documentation

Status
In progress
Assign
Pradhumna Pancholi
type
House Cleaning
effort points
10
Start Date
Jun 14, 2022
End Date
priority
high
tags
Dev Workflow
Github PR
As we are moving towards more mature and stable product. Some parts of theme-extenion-app needs significant refactor e.g. : token ABI, global variables, etc. Also, adding some robust documentation to make it more readable and easy to understand.
This will also get rid of some duplicated lines of code and help with enforcing better error handling. In addition to this, it will make unit testing easier.
 
  1. connectWallet - Make global variables for provider, signer, and user address to be easily accessible.
  1. processTransaction
    1. Get rid of accessing wallet variables from provider and use global variable
    2. Refactor nested verification for network
    3. Implement generic method to lead email screen and verification.
  1. performTransaction
    1. Create generic ABI for all three tokens (all ERC-20 tokens)
    2. Refactor repeated transfer call
    3. Refactor nested if - else
  1. getShopAddr - Update then with async await
  1. getCartData - Update then with async await
  1. loadEmailScreen - Implement a generic function and can load the email screen. It is a big chunk of code repeated inside redeem and processTransaction as state management and email validation was time consuming and had some blockers when NFT redemption was initially shipped.
  1. validateEmail - Regular expression to validate email is repeated and nested inside email screen logic. It needs to be a generic pure function for a cleaner implementation.
  1. redeem
    1. Get rid of repeated wallet verification
    2. Implemented generic function to load and validate email screen.