-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Subaccounts #4456
base: dev
Are you sure you want to change the base?
feat: Subaccounts #4456
Conversation
Branch preview✅ Deploy successful! Storybook: |
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1666 tests passing in 227 suites. Report generated by 🧪jest coverage report action from cc3c894 |
📦 Next.js Bundle Analysis for safe-wallet-webThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
1.2 MB (🟡 +220 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Twenty-three Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/apps |
25.72 KB (🟢 -13.8 KB) |
1.22 MB |
/apps/custom |
23.77 KB (🟢 -13.8 KB) |
1.22 MB |
/apps/open |
8.24 KB (🟢 -45.48 KB) |
1.21 MB |
/balances |
37.48 KB (🟢 -95 B) |
1.23 MB |
/balances/nfts |
16.88 KB (🟢 -667 B) |
1.21 MB |
/bridge |
1.79 KB (🟢 -796 B) |
1.2 MB |
/home |
38.87 KB (🟢 -19.78 KB) |
1.24 MB |
/new-safe/advanced-create |
20.99 KB (🟢 -15.78 KB) |
1.22 MB |
/new-safe/create |
20.08 KB (🟢 -15.78 KB) |
1.22 MB |
/new-safe/load |
5.23 KB (🟢 -11.09 KB) |
1.2 MB |
/settings/environment-variables |
8.51 KB (🟢 -282 B) |
1.21 MB |
/settings/notifications |
26.65 KB (🟢 -179 B) |
1.22 MB |
/settings/safe-apps |
10.26 KB (🟢 -12.91 KB) |
1.21 MB |
/settings/setup |
38.02 KB (🟢 -8.24 KB) |
1.23 MB |
/share/safe-app |
8.57 KB (🟢 -601 B) |
1.21 MB |
/stake |
588 B (🟢 -22 B) |
1.2 MB |
/swap |
730 B (🟢 -22 B) |
1.2 MB |
/transactions |
56.02 KB (🟢 -54 KB) |
1.25 MB |
/transactions/history |
55.98 KB (🟢 -54 KB) |
1.25 MB |
/transactions/messages |
17.6 KB (🟢 -46.31 KB) |
1.21 MB |
/transactions/msg |
8.33 KB (🟢 -46.4 KB) |
1.21 MB |
/transactions/queue |
7.42 KB (🟢 -45.56 KB) |
1.2 MB |
/transactions/tx |
1000 B (🟢 -45.91 KB) |
1.2 MB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking and working great 🔥
I added some comments regarding multichain compatibility
Feature wise:
I think we could already add a new page on e.g. route /subaccounts
which fetches and lists all SubAccounts / owned Safes of the currently opened Safe and simply offers links to open those.
We could also include the Create button there.
src/components/tx-flow/flows/CreateSubaccount/SetupSubaccount.tsx
Outdated
Show resolved
Hide resolved
src/components/tx-flow/flows/CreateSubaccount/ReviewSubaccount.tsx
Outdated
Show resolved
Hide resolved
src/components/tx-flow/flows/CreateSubaccount/ReviewSubaccount.tsx
Outdated
Show resolved
Hide resolved
// TODO: Add link | ||
href="#" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking this so we don't forget.
}, | ||
chain, | ||
) | ||
const saltNonce = subaccounts.safes.length.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could cause issues if someone replaces the parent Safe in the subaccount as the nonce would then be used up already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could either use the getAvailableSaltNonce
function or maybe just use Date.now
as these accounts are deployed immediately and not counterfactual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the Safes aren't counterfactual, I changed it to Date.now
in 322f47d.
What it solves
Implementation of creating (and funding) Subaccounts
How this PR fixes it
A new sidebar icon, context menu (accessible via the icon/drawer) and settings have been added that both list and open a Subaccount creation flow.
How to test it
Open a Safe and observe:
Screenshots
Checklist