-
Notifications
You must be signed in to change notification settings - Fork 471
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
Refactor: use balances RTK query #4770
base: dev
Are you sure you want to change the base?
Conversation
Branch preview❌ Deploy failed! |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟡 | Statements | 77.12% (-0.41% 🔻) |
13812/17910 |
🔴 | Branches | 56.71% (-0.42% 🔻) |
3501/6173 |
🟡 | Functions | 62.03% (-0.9% 🔻) |
2062/3324 |
🟡 | Lines | 78.57% (-0.38% 🔻) |
12469/15870 |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🔴 | ... / approvals.ts |
54.55% (-10.91% 🔻) |
22.22% (-3.7% 🔻) |
50% (-16.67% 🔻) |
52% (-12% 🔻) |
🟢 | ... / useBalances.ts |
95% (-5% 🔻) |
75% (-25% 🔻) |
100% | 97.22% (-2.78% 🔻) |
🟢 | ... / index.tsx |
81.25% (-18.75% 🔻) |
44.44% (-27.78% 🔻) |
14.29% (-85.71% 🔻) |
82.61% (-17.39% 🔻) |
🟡 | ... / index.tsx |
64.58% (-4.17% 🔻) |
32.26% (-12.9% 🔻) |
28.57% (-14.29% 🔻) |
63.04% (-4.35% 🔻) |
🟡 | ... / index.tsx |
54.55% (-45.45% 🔻) |
0% (-66.67% 🔻) |
0% (-100% 🔻) |
66.67% (-33.33% 🔻) |
🟢 | ... / index.tsx |
100% | 80% (-20% 🔻) |
100% | 100% |
🔴 | ... / useHideAssets.ts |
48.33% (-45% 🔻) |
0% (-71.43% 🔻) |
18.75% (-75% 🔻) |
51.92% (-42.31% 🔻) |
🟡 | ... / SendButton.tsx |
73.33% (-26.67% 🔻) |
0% (-50% 🔻) |
0% (-50% 🔻) |
78.57% (-21.43% 🔻) |
🔴 | ... / index.tsx |
40% (-5% 🔻) |
0% | 0% | 51.43% (-4.82% 🔻) |
🟡 | ... / useLoadSpendingLimits.ts |
71.21% (-6.21% 🔻) |
50% (-3.33% 🔻) |
68.75% (-9.82% 🔻) |
74.07% (-4.77% 🔻) |
🟡 | ... / useVisibleBalances.ts |
60% (-40% 🔻) |
8.33% (-66.67% 🔻) |
42.86% (-57.14% 🔻) |
60.87% (-39.13% 🔻) |
🟢 | ... / index.tsx |
93.75% (-6.25% 🔻) |
75% (+25% 🔼) |
66.67% (-33.33% 🔻) |
100% |
Test suite run failed
Failed tests: 12/1788. Failed suites: 4/241.
● AssetsTable › select and deselect hidden assets
expect(received).not.toBeNull()
Received: null
Ignored nodes: comments, script, style
<html>
<head>
<meta
content=""
name="emotion-insertion-point"
/>
</head>
<body>
<div>
<div
class="MuiBox-root css-ccezlm"
>
<div
class="wrapper MuiBox-root css-0"
>
<div
class="hideTokensHeader MuiBox-root css-0"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
data-testid="VisibilityOffOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6m-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14M2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13m-3.4-3.4 1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53"
/>
</svg>
<p
class="MuiTypography-root MuiTypography-body2 css-1kc0ppn-MuiTypography-root"
>
0
tokens
selected
</p>
</div>
<div
class="MuiBox-root css-5ax1kt"
>
<span
data-track="assets: Cancel hide dialog"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary cancelButton css-1agqvgt-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Cancel
</button>
</span>
<span
data-track="assets: Deselect all hide dialog"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary cancelButton css-1agqvgt-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Deselect all
</button>
</span>
<span
data-track="assets: Save hide dialog"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall MuiButton-colorPrimary applyButton css-1gbczjd-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Save
</button>
</span>
</div>
</div>
</div>
<div
class="container"
>
<div
class="MuiBox-root css-8atqhb"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiTableContainer-root css-1px6nn0-MuiPaper-root-MuiTableContainer-root"
data-testid="table-container"
style="--Paper-shadow: none;"
>
<table
aria-labelledby="tableTitle"
class="MuiTable-root css-14ipoqq-MuiTable-root"
>
<thead
class="MuiTableHead-root css-1bxxo5-MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head css-ee4r5n-MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium css-nw4suu-MuiTableCell-root"
scope="col"
>
<span
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-directionAsc css-jvotfa-MuiButtonBase-root-MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Asset
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc css-1f9eu6x-MuiSvgIcon-root-MuiTableSortLabel-icon"
data-testid="ArrowDownwardIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium css-1ylacf2-MuiTableCell-root"
scope="col"
>
<span
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-directionAsc css-jvotfa-MuiButtonBase-root-MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Balance
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc css-1f9eu6x-MuiSvgIcon-root-MuiTableSortLabel-icon"
data-testid="ArrowDownwardIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium css-1wro2k3-MuiTableCell-root"
scope="col"
>
<span
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-directionAsc css-jvotfa-MuiButtonBase-root-MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Value
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc css-1f9eu6x-MuiSvgIcon-root-MuiTableSortLabel-icon"
data-testid="ArrowDownwardIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium sticky css-1ylacf2-MuiTableCell-root"
scope="col"
/>
</tr>
</thead>
<tbody
class="MuiTableBody-root css-q3i0o9-MuiTableBody-root"
>
<tr
class="MuiTableRow-root css-ee4r5n-MuiTableRow-root"
>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-sizeMedium css-v0c5dw-MuiTableCell-root"
/>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<button
data-testid="showHidden"
/>
<ul>
<li>
0x0000000000000000000000000000000000000002
</li>
<li>
0x0000000000000000000000000000000000000003
</li>
</ul>
</div>
</body>
</html>
119 |
120 | await waitFor(() => {
> 121 | expect(result.queryByText('100 DAI')).not.toBeNull()
| ^
122 | expect(result.queryByText('200 SPM')).not.toBeNull()
123 | })
124 |
at toBeNull (src/components/balances/AssetsTable/index.test.tsx:121:49)
at runWithExpensiveErrorDiagnosticsDisabled (../../node_modules/@testing-library/dom/dist/config.js:47:12)
at checkCallback (../../node_modules/@testing-library/dom/dist/wait-for.js:124:77)
at ../../node_modules/@testing-library/dom/dist/wait-for.js:82:9
● AssetsTable › Deselect all and save
expect(received).not.toBeNull()
Received: null
Ignored nodes: comments, script, style
<html>
<head>
<meta
content=""
name="emotion-insertion-point"
/>
</head>
<body>
<div>
<div
class="MuiBox-root css-ccezlm"
>
<div
class="wrapper MuiBox-root css-0"
>
<div
class="hideTokensHeader MuiBox-root css-0"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
data-testid="VisibilityOffOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6m-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14M2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13m-3.4-3.4 1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53"
/>
</svg>
<p
class="MuiTypography-root MuiTypography-body2 css-1kc0ppn-MuiTypography-root"
>
0
tokens
selected
</p>
</div>
<div
class="MuiBox-root css-5ax1kt"
>
<span
data-track="assets: Cancel hide dialog"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary cancelButton css-1agqvgt-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Cancel
</button>
</span>
<span
data-track="assets: Deselect all hide dialog"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-outlined MuiButton-outlinedPrimary MuiButton-sizeSmall MuiButton-outlinedSizeSmall MuiButton-colorPrimary cancelButton css-1agqvgt-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Deselect all
</button>
</span>
<span
data-track="assets: Save hide dialog"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall MuiButton-colorPrimary MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall MuiButton-colorPrimary applyButton css-1gbczjd-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Save
</button>
</span>
</div>
</div>
</div>
<div
class="container"
>
<div
class="MuiBox-root css-8atqhb"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiTableContainer-root css-1px6nn0-MuiPaper-root-MuiTableContainer-root"
data-testid="table-container"
style="--Paper-shadow: none;"
>
<table
aria-labelledby="tableTitle"
class="MuiTable-root css-14ipoqq-MuiTable-root"
>
<thead
class="MuiTableHead-root css-1bxxo5-MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head css-ee4r5n-MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium css-nw4suu-MuiTableCell-root"
scope="col"
>
<span
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-directionAsc css-jvotfa-MuiButtonBase-root-MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Asset
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc css-1f9eu6x-MuiSvgIcon-root-MuiTableSortLabel-icon"
data-testid="ArrowDownwardIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium css-1ylacf2-MuiTableCell-root"
scope="col"
>
<span
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-directionAsc css-jvotfa-MuiButtonBase-root-MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Balance
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc css-1f9eu6x-MuiSvgIcon-root-MuiTableSortLabel-icon"
data-testid="ArrowDownwardIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium css-1wro2k3-MuiTableCell-root"
scope="col"
>
<span
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-directionAsc css-jvotfa-MuiButtonBase-root-MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Value
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc css-1f9eu6x-MuiSvgIcon-root-MuiTableSortLabel-icon"
data-testid="ArrowDownwardIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignLeft MuiTableCell-sizeMedium sticky css-1ylacf2-MuiTableCell-root"
scope="col"
/>
</tr>
</thead>
<tbody
class="MuiTableBody-root css-q3i0o9-MuiTableBody-root"
>
<tr
class="MuiTableRow-root css-ee4r5n-MuiTableRow-root"
>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-sizeMedium css-v0c5dw-MuiTableCell-root"
/>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<button
data-testid="showHidden"
/>
<ul>
<li>
0x0000000000000000000000000000000000000002
</li>
<li>
0x0000000000000000000000000000000000000003
</li>
<li>
0x000000000000000000000000000000000000dead
</li>
</ul>
</div>
</body>
</html>
189 |
190 | await waitFor(() => {
> 191 | expect(result.queryByText('100 DAI')).not.toBeNull()
| ^
192 | expect(result.queryByText('200 SPM')).not.toBeNull()
193 | })
194 |
at toBeNull (src/components/balances/AssetsTable/index.test.tsx:191:49)
at runWithExpensiveErrorDiagnosticsDisabled (../../node_modules/@testing-library/dom/dist/config.js:47:12)
at checkCallback (../../node_modules/@testing-library/dom/dist/wait-for.js:124:77)
at ../../node_modules/@testing-library/dom/dist/wait-for.js:82:9
● AssetsTable › immediately hide visible assets
expect(received).not.toBeNull()
Received: null
285 |
286 | // Initially we see all tokens
> 287 | expect(result.queryByText('100 DAI')).not.toBeNull()
| ^
288 | expect(result.queryByText('200 SPM')).not.toBeNull()
289 |
290 | // hide one token
at Object.toBeNull (src/components/balances/AssetsTable/index.test.tsx:287:47)
● AssetsTable › hideAndUnhideAssets
expect(received).not.toBeNull()
Received: null
385 |
386 | // Initially we see all tokens (as none are hidden)
> 387 | expect(result.queryByText('100 DAI')).not.toBeNull()
| ^
388 | expect(result.queryByText('200 SPM')).not.toBeNull()
389 |
390 | // toggle spam token
at Object.toBeNull (src/components/balances/AssetsTable/index.test.tsx:387:47)
● ApprovalEditor › should modify approvals on save
expect(jest.fn()).toHaveBeenCalledWith(...expected)
- Expected
+ Received
@@ -1,10 +1,11 @@
Object {
"onlyCalls": true,
"transactions": Array [
Object {
- "data": "0x095ea7b3000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a0000000000000000000000000000000000000000000000056bc75e2d63100000",
+ "data": "0x095ea7b3000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a000000000000000000000000000000000000000000000016c4abbebea0100000",
+ "operation": 0,
"to": "0x56E83cd1f6b59DB6dC73FE584BfEe4a986a43b98",
"value": "0",
},
Object {
"data": "0xa9059cbb000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a0000000000000000000000000000000000000000000000000000000000000019",
@@ -12,10 +13,11 @@
"to": "0x56E83cd1f6b59DB6dC73FE584BfEe4a986a43b98",
"value": "0",
},
Object {
"data": "0x39509351000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a000000000000000000000000000000000000000000000000000000a0a7347400",
+ "operation": 0,
"to": "0x56E83cd1f6b59DB6dC73FE584BfEe4a986a43b98",
"value": "0",
},
],
},
Number of calls: 1
218 | })
219 | const mockSafe = getAndValidateSafeSDK()
> 220 | expect(mockSafe.createTransaction).toHaveBeenCalledWith({
| ^
221 | onlyCalls: true,
222 | transactions: [
223 | {
at Object.toHaveBeenCalledWith (src/components/tx/ApprovalEditor/ApprovalEditor.test.tsx:220:40)
● ApprovalEditor › should modify increaseAllowance on save
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: {"onlyCalls": true, "transactions": [{"data": "0x095ea7b3000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad85000000000000000000000000000000000000000000000016c4abbebea0100000", "to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec", "value": "0"}, {"data": "0xa9059cbb000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad850000000000000000000000000000000000000000000000000000000000000019", "operation": 0, "to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec", "value": "0"}, {"data": "0x39509351000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad8500000000000000000000000000000000000000000000001043561a8829300000", "to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec", "value": "0"}]}
Received
1
Object {
"onlyCalls": true,
"transactions": Array [
Object {
- "data": "0x095ea7b3000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad85000000000000000000000000000000000000000000000016c4abbebea0100000",
- "to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec",
+ "data": "0x095ea7b3000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a000000000000000000000000000000000000000000000016c4abbebea0100000",
+ "operation": 0,
+ "to": "0x56E83cd1f6b59DB6dC73FE584BfEe4a986a43b98",
"value": "0",
},
Object {
- "data": "0xa9059cbb000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad850000000000000000000000000000000000000000000000000000000000000019",
+ "data": "0xa9059cbb000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a0000000000000000000000000000000000000000000000000000000000000019",
"operation": 0,
- "to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec",
+ "to": "0x56E83cd1f6b59DB6dC73FE584BfEe4a986a43b98",
"value": "0",
},
Object {
- "data": "0x39509351000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad8500000000000000000000000000000000000000000000001043561a8829300000",
- "to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec",
+ "data": "0x39509351000000000000000000000000deecebcfb4dfbd4fefcd1e9cab9eb8bdf12f3a2a000000000000000000000000000000000000000000000000000000a0a7347400",
+ "operation": 0,
+ "to": "0x56E83cd1f6b59DB6dC73FE584BfEe4a986a43b98",
"value": "0",
},
],
},
2
Object {
"onlyCalls": true,
"transactions": Array [
Object {
"data": "0x095ea7b3000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad85000000000000000000000000000000000000000000000016c4abbebea0100000",
+ "operation": 0,
"to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec",
"value": "0",
},
Object {
"data": "0xa9059cbb000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad850000000000000000000000000000000000000000000000000000000000000019",
"operation": 0,
"to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec",
"value": "0",
},
Object {
- "data": "0x39509351000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad8500000000000000000000000000000000000000000000001043561a8829300000",
+ "data": "0x39509351000000000000000000000000d1bcb2feed0d0019cf9519fb1e6fdedbe972ad85000000000000000000000000000000000000000000000000000000a0a7347400",
+ "operation": 0,
"to": "0xEF58e9fD5301d0a66b3AA1abb31a9eBD96F3c5Ec",
"value": "0",
},
],
},
Number of calls: 2
326 | })
327 | const mockSafe = getAndValidateSafeSDK()
> 328 | expect(mockSafe.createTransaction).toHaveBeenCalledWith({
| ^
329 | onlyCalls: true,
330 | transactions: [
331 | {
at Object.toHaveBeenCalledWith (src/components/tx/ApprovalEditor/ApprovalEditor.test.tsx:328:40)
● useVisibleBalances › empty balance
TypeError: Cannot destructure property 'data' of '((cov_1qa90xnsjr(...).s[9]++) , (0 , _store.useAppSelector)(...))' as it is undefined.
11 | safeError?: string
12 | } => {
> 13 | const { data, error, loading } = useAppSelector(selectSafeInfo, isEqual)
| ^
14 |
15 | return useMemo(
16 | () => ({
at data (src/hooks/useSafeInfo.ts:13:11)
at useBalances (src/hooks/useBalances.ts:43:56)
at useVisibleBalances (src/hooks/useVisibleBalances.ts:48:44)
at src/hooks/__tests__/useVisibleBalances.test.ts:35:59
at TestComponent (node_modules/@testing-library/react/dist/pure.js:309:27)
at Object.react-stack-bottom-frame (node_modules/react-dom/cjs/react-dom-client.development.js:22428:20)
at renderWithHooks (node_modules/react-dom/cjs/react-dom-client.development.js:5757:22)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom-client.development.js:8018:19)
at beginWork (node_modules/react-dom/cjs/react-dom-client.development.js:9683:18)
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:543:16)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom-client.development.js:15052:22)
at workLoopSync (node_modules/react-dom/cjs/react-dom-client.development.js:14870:41)
at renderRootSync (node_modules/react-dom/cjs/react-dom-client.development.js:14850:11)
at performWorkOnRoot (node_modules/react-dom/cjs/react-dom-client.development.js:14384:44)
at performWorkOnRootViaSchedulerTask (node_modules/react-dom/cjs/react-dom-client.development.js:15931:7)
at flushActQueue (node_modules/react/cjs/react.development.js:862:34)
at Object.<anonymous>.process.env.NODE_ENV.exports.act (node_modules/react/cjs/react.development.js:1151:10)
at node_modules/@testing-library/react/dist/act-compat.js:47:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:180:26)
at render (node_modules/@testing-library/react/dist/pure.js:271:10)
at renderHook (node_modules/@testing-library/react/dist/pure.js:318:7)
at customRenderHook (src/tests/test-utils.tsx:86:20)
at Object.<anonymous> (src/hooks/__tests__/useVisibleBalances.test.ts:35:34)
● useVisibleBalances › return only visible balance
TypeError: Cannot destructure property 'data' of '((cov_1qa90xnsjr(...).s[9]++) , (0 , _store.useAppSelector)(...))' as it is undefined.
11 | safeError?: string
12 | } => {
> 13 | const { data, error, loading } = useAppSelector(selectSafeInfo, isEqual)
| ^
14 |
15 | return useMemo(
16 | () => ({
at data (src/hooks/useSafeInfo.ts:13:11)
at useBalances (src/hooks/useBalances.ts:43:56)
at useVisibleBalances (src/hooks/useVisibleBalances.ts:48:44)
at src/hooks/__tests__/useVisibleBalances.test.ts:93:59
at TestComponent (node_modules/@testing-library/react/dist/pure.js:309:27)
at Object.react-stack-bottom-frame (node_modules/react-dom/cjs/react-dom-client.development.js:22428:20)
at renderWithHooks (node_modules/react-dom/cjs/react-dom-client.development.js:5757:22)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom-client.development.js:8018:19)
at beginWork (node_modules/react-dom/cjs/react-dom-client.development.js:9683:18)
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:543:16)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom-client.development.js:15052:22)
at workLoopSync (node_modules/react-dom/cjs/react-dom-client.development.js:14870:41)
at renderRootSync (node_modules/react-dom/cjs/react-dom-client.development.js:14850:11)
at performWorkOnRoot (node_modules/react-dom/cjs/react-dom-client.development.js:14384:44)
at performWorkOnRootViaSchedulerTask (node_modules/react-dom/cjs/react-dom-client.development.js:15931:7)
at flushActQueue (node_modules/react/cjs/react.development.js:862:34)
at Object.<anonymous>.process.env.NODE_ENV.exports.act (node_modules/react/cjs/react.development.js:1151:10)
at node_modules/@testing-library/react/dist/act-compat.js:47:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:180:26)
at render (node_modules/@testing-library/react/dist/pure.js:271:10)
at renderHook (node_modules/@testing-library/react/dist/pure.js:318:7)
at customRenderHook (src/tests/test-utils.tsx:86:20)
at Object.<anonymous> (src/hooks/__tests__/useVisibleBalances.test.ts:93:34)
● useVisibleBalances › computation works for high precision numbers
TypeError: Cannot destructure property 'data' of '((cov_1qa90xnsjr(...).s[9]++) , (0 , _store.useAppSelector)(...))' as it is undefined.
11 | safeError?: string
12 | } => {
> 13 | const { data, error, loading } = useAppSelector(selectSafeInfo, isEqual)
| ^
14 |
15 | return useMemo(
16 | () => ({
at data (src/hooks/useSafeInfo.ts:13:11)
at useBalances (src/hooks/useBalances.ts:43:56)
at useVisibleBalances (src/hooks/useVisibleBalances.ts:48:44)
at src/hooks/__tests__/useVisibleBalances.test.ts:164:59
at TestComponent (node_modules/@testing-library/react/dist/pure.js:309:27)
at Object.react-stack-bottom-frame (node_modules/react-dom/cjs/react-dom-client.development.js:22428:20)
at renderWithHooks (node_modules/react-dom/cjs/react-dom-client.development.js:5757:22)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom-client.development.js:8018:19)
at beginWork (node_modules/react-dom/cjs/react-dom-client.development.js:9683:18)
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:543:16)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom-client.development.js:15052:22)
at workLoopSync (node_modules/react-dom/cjs/react-dom-client.development.js:14870:41)
at renderRootSync (node_modules/react-dom/cjs/react-dom-client.development.js:14850:11)
at performWorkOnRoot (node_modules/react-dom/cjs/react-dom-client.development.js:14384:44)
at performWorkOnRootViaSchedulerTask (node_modules/react-dom/cjs/react-dom-client.development.js:15931:7)
at flushActQueue (node_modules/react/cjs/react.development.js:862:34)
at Object.<anonymous>.process.env.NODE_ENV.exports.act (node_modules/react/cjs/react.development.js:1151:10)
at node_modules/@testing-library/react/dist/act-compat.js:47:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:180:26)
at render (node_modules/@testing-library/react/dist/pure.js:271:10)
at renderHook (node_modules/@testing-library/react/dist/pure.js:318:7)
at customRenderHook (src/tests/test-utils.tsx:86:20)
at Object.<anonymous> (src/hooks/__tests__/useVisibleBalances.test.ts:164:34)
● useVisibleBalances › computation works for high USD values
TypeError: Cannot destructure property 'data' of '((cov_1qa90xnsjr(...).s[9]++) , (0 , _store.useAppSelector)(...))' as it is undefined.
11 | safeError?: string
12 | } => {
> 13 | const { data, error, loading } = useAppSelector(selectSafeInfo, isEqual)
| ^
14 |
15 | return useMemo(
16 | () => ({
at data (src/hooks/useSafeInfo.ts:13:11)
at useBalances (src/hooks/useBalances.ts:43:56)
at useVisibleBalances (src/hooks/useVisibleBalances.ts:48:44)
at src/hooks/__tests__/useVisibleBalances.test.ts:223:59
at TestComponent (node_modules/@testing-library/react/dist/pure.js:309:27)
at Object.react-stack-bottom-frame (node_modules/react-dom/cjs/react-dom-client.development.js:22428:20)
at renderWithHooks (node_modules/react-dom/cjs/react-dom-client.development.js:5757:22)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom-client.development.js:8018:19)
at beginWork (node_modules/react-dom/cjs/react-dom-client.development.js:9683:18)
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:543:16)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom-client.development.js:15052:22)
at workLoopSync (node_modules/react-dom/cjs/react-dom-client.development.js:14870:41)
at renderRootSync (node_modules/react-dom/cjs/react-dom-client.development.js:14850:11)
at performWorkOnRoot (node_modules/react-dom/cjs/react-dom-client.development.js:14384:44)
at performWorkOnRootViaSchedulerTask (node_modules/react-dom/cjs/react-dom-client.development.js:15931:7)
at flushActQueue (node_modules/react/cjs/react.development.js:862:34)
at Object.<anonymous>.process.env.NODE_ENV.exports.act (node_modules/react/cjs/react.development.js:1151:10)
at node_modules/@testing-library/react/dist/act-compat.js:47:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:180:26)
at render (node_modules/@testing-library/react/dist/pure.js:271:10)
at renderHook (node_modules/@testing-library/react/dist/pure.js:318:7)
at customRenderHook (src/tests/test-utils.tsx:86:20)
at Object.<anonymous> (src/hooks/__tests__/useVisibleBalances.test.ts:223:34)
● useBalances › empty balance
TypeError: Cannot read properties of undefined (reading 'currency')
147 |
148 | export const selectCurrency = (state: RootState): SettingsState['currency'] => {
> 149 | return state[settingsSlice.name].currency || initialState.currency
| ^
150 | }
151 |
152 | export const selectTokenList = (state: RootState): SettingsState['tokenList'] => {
at currency (src/store/settingsSlice.ts:149:36)
at selector (src/hooks/__tests__/useBalances.test.ts:14:7)
at useBalances (src/hooks/useBalances.ts:41:34)
at src/hooks/__tests__/useBalances.test.ts:19:52
at TestComponent (node_modules/@testing-library/react/dist/pure.js:309:27)
at Object.react-stack-bottom-frame (node_modules/react-dom/cjs/react-dom-client.development.js:22428:20)
at renderWithHooks (node_modules/react-dom/cjs/react-dom-client.development.js:5757:22)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom-client.development.js:8018:19)
at beginWork (node_modules/react-dom/cjs/react-dom-client.development.js:9683:18)
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:543:16)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom-client.development.js:15052:22)
at workLoopSync (node_modules/react-dom/cjs/react-dom-client.development.js:14870:41)
at renderRootSync (node_modules/react-dom/cjs/react-dom-client.development.js:14850:11)
at performWorkOnRoot (node_modules/react-dom/cjs/react-dom-client.development.js:14384:44)
at performWorkOnRootViaSchedulerTask (node_modules/react-dom/cjs/react-dom-client.development.js:15931:7)
at flushActQueue (node_modules/react/cjs/react.development.js:862:34)
at Object.<anonymous>.process.env.NODE_ENV.exports.act (node_modules/react/cjs/react.development.js:1151:10)
at node_modules/@testing-library/react/dist/act-compat.js:47:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:180:26)
at render (node_modules/@testing-library/react/dist/pure.js:271:10)
at renderHook (node_modules/@testing-library/react/dist/pure.js:318:7)
at customRenderHook (src/tests/test-utils.tsx:86:20)
at Object.<anonymous> (src/hooks/__tests__/useBalances.test.ts:19:34)
● useBalances › return all balances
TypeError: Cannot read properties of undefined (reading 'currency')
147 |
148 | export const selectCurrency = (state: RootState): SettingsState['currency'] => {
> 149 | return state[settingsSlice.name].currency || initialState.currency
| ^
150 | }
151 |
152 | export const selectTokenList = (state: RootState): SettingsState['tokenList'] => {
at currency (src/store/settingsSlice.ts:149:36)
at selector (src/hooks/__tests__/useBalances.test.ts:60:7)
at useBalances (src/hooks/useBalances.ts:41:34)
at src/hooks/__tests__/useBalances.test.ts:65:52
at TestComponent (node_modules/@testing-library/react/dist/pure.js:309:27)
at Object.react-stack-bottom-frame (node_modules/react-dom/cjs/react-dom-client.development.js:22428:20)
at renderWithHooks (node_modules/react-dom/cjs/react-dom-client.development.js:5757:22)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom-client.development.js:8018:19)
at beginWork (node_modules/react-dom/cjs/react-dom-client.development.js:9683:18)
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:543:16)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom-client.development.js:15052:22)
at workLoopSync (node_modules/react-dom/cjs/react-dom-client.development.js:14870:41)
at renderRootSync (node_modules/react-dom/cjs/react-dom-client.development.js:14850:11)
at performWorkOnRoot (node_modules/react-dom/cjs/react-dom-client.development.js:14384:44)
at performWorkOnRootViaSchedulerTask (node_modules/react-dom/cjs/react-dom-client.development.js:15931:7)
at flushActQueue (node_modules/react/cjs/react.development.js:862:34)
at Object.<anonymous>.process.env.NODE_ENV.exports.act (node_modules/react/cjs/react.development.js:1151:10)
at node_modules/@testing-library/react/dist/act-compat.js:47:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:180:26)
at render (node_modules/@testing-library/react/dist/pure.js:271:10)
at renderHook (node_modules/@testing-library/react/dist/pure.js:318:7)
at customRenderHook (src/tests/test-utils.tsx:86:20)
at Object.<anonymous> (src/hooks/__tests__/useBalances.test.ts:65:34)
Report generated by 🧪jest coverage report action from fee8fd4
const { safe, safeAddress, safeLoaded } = useSafeInfo() | ||
const isReady = safeLoaded && isTrustedTokenList !== undefined | ||
|
||
const { data, isLoading, error } = useBalancesGetBalancesV1Query( |
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.
Are we still polling the balances?
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.
Part two of this PR is going to be to replace balances polling with a Safe Overview fetching because we actually only need the fiat total, not all the balances.
Skip token
924aebb
to
fee8fd4
Compare
What it solves
useLoadBalances
and thebalancesSlice
useBalances
Todo: