Outblock / FRW-Extension

Flow Reference Wallet - Chrome Extension Client
1 stars 4 forks source link

[FEATURE] Storage Alert #145

Open lmcmz opened 1 week ago

lmcmz commented 1 week ago

Issue to be solved

Background: https://github.com/Outblock/FRW/issues/61

Suggest A Solution

Get Storage and Available Balance Info

Our script API returns getAccountInfo cadence, which allow wallet to get the storage info under an account.

access(all) struct Result {
  access(all) let address: Address
  access(all) let balance: UFix64
  access(all) let availableBalance: UFix64
  access(all) let storageUsed: UInt64
  access(all) let storageCapacity: UInt64
  access(all) let storageFlow: UFix64,
}

If storageCapacity - storageUsed < 10000 then it's insufficient storage

Notification

Currently, we use firebase remote config to control the notification messages. It use news at the moment. For insufficient storage alert, we gonna add a new condition flag insufficientStorage, which user reach storage limit.

Onchain Interaction

Any onchain Interaction, wallet need do a async check whether the storage is sufficient or not.

If it's send Flow Token or move action ( move fee ), the balance will be affected we need take count of the sending or move fee balance. ( availableBalance - sent amount ) < 0.001 Other onchain Interaction, we only do the availableBalance check.

Storage Usage Card

Storage info card need to be displayed only under FLOW token detail page.

Figma: https://www.figma.com/design/Qs5stGXY2US8Dj8UDjsdQ5/FLOW--Extention-Design-v2.0.0?node-id=19322-3404&t=XuGSo0DCk4j4z7BJ-1

tombeckenham commented 5 days ago

The design was used in another feature https://www.figma.com/design/Qs5stGXY2US8Dj8UDjsdQ5/FLOW--Extention-Design-v2.0.0?node-id=16584-262&node-type=frame&t=wfFzCZHzFpyc9oWL-0

tombeckenham commented 1 day ago

Additional requirements:

we need update the storage alert condition:

if storageCapacity - storageUsed < 10000 {
   // Show insufficient storage alert
  return
} 

Let me list out all scenarios with storage warning in action button:

Move token Move NFT Send Token Send NFT Sign Transaction on browser Sign Transaction on WalletConnect