Skip to content

Commit 7ea0cce

Browse files
replace manual hex slicing with ABI-based decoding for ERC-20/721/1155 transfers
1 parent fe07165 commit 7ea0cce

5 files changed

Lines changed: 944 additions & 87 deletions

File tree

src/_core/usdPrices.test.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
* @jest-environment jsdom
33
*/
4-
import React from 'react';
54
import { renderHook } from '@testing-library/react';
5+
import React from 'react';
66

77
import { NetworkName } from '../networks/types';
88
import {
99
UsdPricesProvider,
10-
useUsdPrices,
1110
useUnit0UsdPrices,
11+
useUsdPrices,
1212
} from './usdPrices';
1313

1414
const mockUsePopupSelector = jest.fn();
@@ -60,10 +60,9 @@ describe('useUsdPrices', () => {
6060
});
6161

6262
it('returns prices filtered by the requested asset IDs', () => {
63-
const { result } = renderHook(
64-
() => useUsdPrices(['WAVES', 'ABOT']),
65-
{ wrapper },
66-
);
63+
const { result } = renderHook(() => useUsdPrices(['WAVES', 'ABOT']), {
64+
wrapper,
65+
});
6766

6867
expect(result.current).toEqual({ WAVES: 2.5, ABOT: 1.0 });
6968
});
@@ -76,10 +75,9 @@ describe('useUsdPrices', () => {
7675
});
7776

7877
it('returns empty object when no asset IDs match', () => {
79-
const { result } = renderHook(
80-
() => useUsdPrices(['unknownAsset']),
81-
{ wrapper },
82-
);
78+
const { result } = renderHook(() => useUsdPrices(['unknownAsset']), {
79+
wrapper,
80+
});
8381

8482
expect(result.current).toEqual({});
8583
});
@@ -112,10 +110,9 @@ describe('useUnit0UsdPrices', () => {
112110
});
113111

114112
it('returns prices for the UNIT0 native address', () => {
115-
const { result } = renderHook(
116-
() => useUnit0UsdPrices(['unit0']),
117-
{ wrapper },
118-
);
113+
const { result } = renderHook(() => useUnit0UsdPrices(['unit0']), {
114+
wrapper,
115+
});
119116

120117
expect(result.current).toEqual({ UNIT0: 0.01 });
121118
});
@@ -131,7 +128,9 @@ describe('useUnit0UsdPrices', () => {
131128
{ wrapper },
132129
);
133130

134-
expect(result.current).toEqual({ '0xb303d80db8415fd1d3c9fed68a52eeac9a052671': 3.0 });
131+
expect(result.current).toEqual({
132+
'0xb303d80db8415fd1d3c9fed68a52eeac9a052671': 3.0,
133+
});
135134
});
136135

137136
it('normalizes the unit0 native address to uppercase UNIT0', () => {
@@ -140,20 +139,18 @@ describe('useUnit0UsdPrices', () => {
140139
usdPrices: { UNIT0: 0.01 },
141140
});
142141

143-
const { result } = renderHook(
144-
() => useUnit0UsdPrices(['unit0']),
145-
{ wrapper },
146-
);
142+
const { result } = renderHook(() => useUnit0UsdPrices(['unit0']), {
143+
wrapper,
144+
});
147145

148146
expect(result.current).toHaveProperty('UNIT0');
149147
expect(result.current).not.toHaveProperty('unit0');
150148
});
151149

152150
it('returns empty object when no addresses match', () => {
153-
const { result } = renderHook(
154-
() => useUnit0UsdPrices(['0xunknown']),
155-
{ wrapper },
156-
);
151+
const { result } = renderHook(() => useUnit0UsdPrices(['0xunknown']), {
152+
wrapper,
153+
});
157154

158155
expect(result.current).toEqual({});
159156
});

src/_core/useSentryNavigationBreadcrumbs.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* @jest-environment jsdom
33
*/
4-
import { renderHook } from '@testing-library/react';
54
import { addBreadcrumb } from '@sentry/browser';
5+
import { renderHook } from '@testing-library/react';
66
import type { Location } from 'react-router-dom';
77

88
import { useSentryNavigationBreadcrumbs } from './useSentryNavigationBreadcrumbs';
@@ -23,9 +23,7 @@ describe('useSentryNavigationBreadcrumbs', () => {
2323
});
2424

2525
it('adds a breadcrumb with null "from" on initial render', () => {
26-
renderHook(() =>
27-
useSentryNavigationBreadcrumbs(makeLocation('/home')),
28-
);
26+
renderHook(() => useSentryNavigationBreadcrumbs(makeLocation('/home')));
2927

3028
expect(mockAddBreadcrumb).toHaveBeenCalledTimes(1);
3129
expect(mockAddBreadcrumb).toHaveBeenCalledWith({

0 commit comments

Comments
 (0)