File tree 4 files changed +30
-8
lines changed
confirmations/components/transaction-alerts
4 files changed +30
-8
lines changed Original file line number Diff line number Diff line change 1
- const zeroAddress = function ( ) {
2
- const addressLength = 20
3
- const addr = zeros ( addressLength )
4
- return bufferToHex ( addr )
5
- }
1
+ // Vendored from [email protected]
6
2
3
+ /**
4
+ * Converts a `Buffer` into a `0x`-prefixed hex `String`.
5
+ *
6
+ * @param buf - `Buffer` object to convert
7
+ */
8
+ const bufferToHex = function ( buf ) {
9
+ // buf = toBuffer(buf);
10
+ return `0x${ buf . toString ( 'hex' ) } ` ;
11
+ } ;
12
+
13
+ /**
14
+ * Returns a buffer filled with 0s.
15
+ *
16
+ * @param bytes - the number of bytes the buffer should be
17
+ */
18
+ const zeros = function ( bytes ) {
19
+ return Buffer . allocUnsafe ( bytes ) . fill ( 0 ) ;
20
+ } ;
21
+
22
+ const zeroAddress = function ( ) {
23
+ const addressLength = 20 ;
24
+ const addr = zeros ( addressLength ) ;
25
+ return bufferToHex ( addr ) ;
26
+ } ;
7
27
8
28
module . exports = {
9
29
zeroAddress,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { BigNumber } from 'ethers';
2
2
import { renderHookWithProvider } from '../../../test/lib/render-helpers' ;
3
3
import { CHAIN_IDS } from '../../../shared/constants/network' ;
4
4
import { createBridgeMockStore } from '../../../test/jest/mock-store' ;
5
- import { zeroAddress } from '../../__mocks__/util' ;
5
+ import { zeroAddress } from '../../__mocks__/ethereumjs- util' ;
6
6
import { createTestProviderTools } from '../../../test/stub/provider' ;
7
7
import * as tokenutil from '../../../shared/lib/token-util' ;
8
8
import useLatestBalance from './useLatestBalance' ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import fetchWithCache from '../../../shared/lib/fetch-with-cache';
2
2
import { CHAIN_IDS } from '../../../shared/constants/network' ;
3
3
import mockBridgeQuotesErc20Erc20 from '../../../test/data/bridge/mock-quotes-erc20-erc20.json' ;
4
4
import mockBridgeQuotesNativeErc20 from '../../../test/data/bridge/mock-quotes-native-erc20.json' ;
5
- import { zeroAddress } from '../../__mocks__/util' ;
5
+ import { zeroAddress } from '../../__mocks__/ethereumjs- util' ;
6
6
import {
7
7
fetchBridgeFeatureFlags ,
8
8
fetchBridgeQuotes ,
Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ const customTransaction = ({
44
44
} ;
45
45
// just simulate hash if not provided
46
46
if ( ! props ?. hash ) {
47
- tx . hash = `0x${ Buffer . from ( keccak256 ( Buffer . from ( JSON . stringify ( tx ) ) ) ) . toString ( 'hex' ) } ` ;
47
+ tx . hash = `0x${ Buffer . from (
48
+ keccak256 ( Buffer . from ( JSON . stringify ( tx ) ) ) ,
49
+ ) . toString ( 'hex' ) } `;
48
50
}
49
51
return tx ;
50
52
} ;
You can’t perform that action at this time.
0 commit comments