-
Notifications
You must be signed in to change notification settings - Fork 501
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: Mass payouts #5042
base: dev
Are you sure you want to change the base?
feat: Mass payouts #5042
Conversation
…ient details in token transfer
…ent token transfers
Only allow multiple recipients if Safe is targeted and `TARGETED_MASS_PAYOUTS` feature is active
Branch preview✅ Deploy successful! Storybook: |
📦 Next.js Bundle Analysis for @safe-global/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
1.07 MB (🟡 +84.15 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!
Thirty-five Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/ |
509 B (🟢 -1 B) |
1.07 MB |
/address-book |
23.22 KB (🟡 +155 B) |
1.09 MB |
/apps |
35.75 KB (🟡 +2.03 KB) |
1.11 MB |
/apps/custom |
33.82 KB (🟡 +2.03 KB) |
1.1 MB |
/apps/open |
55.36 KB (🟡 +1.75 KB) |
1.13 MB |
/balances |
29.73 KB (🟡 +25 B) |
1.1 MB |
/balances/nfts |
9.32 KB (🟢 -231 B) |
1.08 MB |
/bridge |
2.55 KB (🟢 -3 B) |
1.07 MB |
/cookie |
8.77 KB (🟡 +1 B) |
1.08 MB |
/home |
61.35 KB (🟡 +2.09 KB) |
1.13 MB |
/licenses |
2.46 KB (🟢 -1 B) |
1.07 MB |
/new-safe/advanced-create |
26.38 KB (🟢 -77 B) |
1.1 MB |
/new-safe/create |
25.52 KB (🟢 -70 B) |
1.1 MB |
/privacy |
14.57 KB (🟡 +2 B) |
1.09 MB |
/settings/appearance |
2.25 KB (🟡 +1 B) |
1.07 MB |
/settings/cookies |
1.87 KB (🟡 +1 B) |
1.07 MB |
/settings/data |
1.79 KB (🟢 -1 B) |
1.07 MB |
/settings/environment-variables |
3.28 KB (🟡 +1 B) |
1.07 MB |
/settings/modules |
2.88 KB (🟢 -1.18 KB) |
1.07 MB |
/settings/notifications |
7.49 KB (🟢 -13.82 KB) |
1.08 MB |
/settings/safe-apps |
20.15 KB (🟡 +1.87 KB) |
1.09 MB |
/settings/security |
2.34 KB (🟡 +2 B) |
1.07 MB |
/settings/setup |
30.98 KB (🟡 +256 B) |
1.1 MB |
/share/safe-app |
7.55 KB (🟢 -9 B) |
1.08 MB |
/stake |
617 B (🟢 -2 B) |
1.07 MB |
/swap |
763 B (🟡 +3 B) |
1.07 MB |
/terms |
12.93 KB (🟡 +1 B) |
1.08 MB |
/transactions |
99.46 KB (🟡 +2.88 KB) |
1.17 MB |
/transactions/history |
99.42 KB (🟡 +2.88 KB) |
1.17 MB |
/transactions/messages |
60.25 KB (🟡 +1.95 KB) |
1.13 MB |
/transactions/msg |
56.5 KB (🟡 +1.95 KB) |
1.13 MB |
/transactions/queue |
49.36 KB (🟡 +1.96 KB) |
1.12 MB |
/transactions/tx |
48.72 KB (🟡 +1.96 KB) |
1.12 MB |
/welcome |
6.93 KB (🟢 -2 B) |
1.08 MB |
/welcome/accounts |
408 B (🟡 +1 B) |
1.07 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.
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟡 | Statements | 77.26% (-0.06% 🔻) |
14312/18524 |
🔴 | Branches | 55.98% (-0.16% 🔻) |
3581/6397 |
🟡 | Functions | 62.07% (-0.21% 🔻) |
2134/3438 |
🟡 | Lines | 78.74% (-0.05% 🔻) |
12929/16420 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🟢 | ... / index.tsx |
92% | 57.14% | 80% | 95.65% |
🟢 | ... / index.tsx |
80% | 0% | 0% | 88.89% |
🟡 | ... / ReviewRecipientRow.tsx |
56.25% | 0% | 0% | 64.29% |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🟢 | ... / useRemoteSafeApps.ts |
86.84% (-4.07% 🔻) |
57.14% (-9.52% 🔻) |
83.33% (-7.58% 🔻) |
90.63% (-2.23% 🔻) |
🟡 | ... / index.tsx |
75% | 33.33% (-16.67% 🔻) |
20% (-5% 🔻) |
75% (-1.47% 🔻) |
🟢 | ... / CreateTokenTransfer.tsx |
80% (-17.62% 🔻) |
50% (-26.19% 🔻) |
50% (-50% 🔻) |
80.65% (-19.35% 🔻) |
🟡 | ... / index.tsx |
62.22% (-13.78% 🔻) |
40.91% (-12.42% 🔻) |
42.86% (+2.86% 🔼) |
64.29% (-13.98% 🔻) |
🔴 | ... / ReviewTokenTransfer.tsx |
42.31% (-1.69% 🔻) |
0% | 0% | 47.83% (-2.17% 🔻) |
Test suite run success
1839 tests passing in 251 suites.
Report generated by 🧪jest coverage report action from 4c28a60
apps/web/src/components/tx-flow/flows/TokenTransfer/RecipientRow/index.tsx
Outdated
Show resolved
Hide resolved
|
||
export enum TokenAmountFields { | ||
tokenAddress = 'tokenAddress', | ||
amount = 'amount', | ||
} | ||
|
||
export const InsufficientFundsValidationError = 'Insufficient funds' |
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.
Nit: whilst this works, RHF errors have a type
that seems more suitable for referencing. What do you think?
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.
Not sure I understand how you would change it. Do you mean the FieldError type? How would you use it?
This string is basically just used as a return value for the validateLimitedAmount
function and then to check whether any such error exists in the form to conditionally render the error alert below it. Happy to refactor but just not sure how :)
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 can keep the constant as it's used in all places but, yes, FieldError['type']
is more explicit. I'm not sure on the feasibility so I'll leave it up to your discretion.
apps/web/src/components/tx-flow/flows/TokenTransfer/CreateTokenTransfer.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/components/tx-flow/flows/TokenTransfer/RecipientRow/index.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/components/tx-flow/flows/TokenTransfer/RecipientRow/index.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/components/tx-flow/flows/TokenTransfer/ReviewRecipientRow.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/components/tx-flow/flows/TokenTransfer/ReviewTokenTransfer.tsx
Outdated
Show resolved
Hide resolved
Also add various other small improvements
} | ||
|
||
// Validate the total amount of the selected token in the multi transfer | ||
const recipients = getValues(MultiTokenTransferFields.recipients) as MultiTokenTransferParams['recipients'] |
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.
Nit: if you pass the form type as a generic to useFormContext
, I think you might get the inferred types.
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.
Done. I had to add a separate useFormContext<MultiTokenTransferParams>()
hook call with the passed generic type because the TokenAmountInput component is also used in CreateSpendingLimit
where the form type is different (no field array). To keep the component working for both usages, the form type can not be specified for the other RFH functions.
…ormContext to preserve type of recipients values
startIcon={<SvgIcon component={AddIcon} inheritViewBox fontSize="small" />} | ||
size="large" | ||
> | ||
Add Recipient |
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.
Add Recipient | |
Add recipient |
Here and everywhere else: please don't use Cap Case in the UI.
@IvaLukan please update the designs accordingly. Thanks!
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.
Fixed
What it solves
Resolves #4895 and #2332
Enhances the token transfer functionality by introducing support for multiple recipients.
How this PR fixes it
Targeted rollout
The feature is behind the
TARGETED_MASS_PAYOUTS
feature flag and will only be available for specific Safe addresses (outreachId = 4).UI & validation improvements
Code changes
CreateTokenTransfer.tsx
)TokenAmountInput/index.tsx
)useRemoteSafeApps
usage to include a tag parameter inBuyCryptoButton/index.tsx
.How to test it
Screenshots
mass-payouts.mp4
Checklist