Skip to content

Commit 185843f

Browse files
committed
refactor order alphabetically
1 parent 1d96bdf commit 185843f

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

packages/transaction-controller/src/EtherscanRemoteTransactionSource.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const ETHERSCAN_TOKEN_TRANSACTION_RESPONSE_EMPTY_MOCK: EtherscanTransactionRespo
8989
const EXPECTED_NORMALISED_TRANSACTION_BASE = {
9090
blockNumber: ETHERSCAN_TRANSACTION_SUCCESS_MOCK.blockNumber,
9191
chainId: undefined,
92+
hash: ETHERSCAN_TRANSACTION_SUCCESS_MOCK.hash,
9293
id: ID_MOCK,
9394
networkID: undefined,
9495
status: TransactionStatus.confirmed,
@@ -102,7 +103,6 @@ const EXPECTED_NORMALISED_TRANSACTION_BASE = {
102103
to: ETHERSCAN_TRANSACTION_SUCCESS_MOCK.to,
103104
value: '0xb1a2bc2ec50000',
104105
},
105-
hash: ETHERSCAN_TRANSACTION_SUCCESS_MOCK.hash,
106106
verifiedOnBlockchain: false,
107107
};
108108

packages/transaction-controller/src/EtherscanRemoteTransactionSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export class EtherscanRemoteTransactionSource
141141
return {
142142
blockNumber: txMeta.blockNumber,
143143
chainId: currentChainId,
144+
hash: txMeta.hash,
144145
id: random({ msecs: time }),
145146
networkID: currentNetworkId,
146147
status: TransactionStatus.confirmed,
@@ -154,7 +155,6 @@ export class EtherscanRemoteTransactionSource
154155
to: txMeta.to,
155156
value: BNToHex(new BN(txMeta.value)),
156157
},
157-
hash: txMeta.hash,
158158
verifiedOnBlockchain: false,
159159
};
160160
}

packages/transaction-controller/src/IncomingTransactionHelper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ const CONTROLLER_ARGS_MOCK = {
4545
const TRANSACTION_MOCK: TransactionMeta = {
4646
blockNumber: '123',
4747
chainId: '0x1',
48+
hash: '0x1',
4849
status: TransactionStatus.submitted,
4950
time: 0,
5051
transaction: { to: '0x1', gasUsed: '0x1' },
51-
hash: '0x1',
5252
} as unknown as TransactionMeta;
5353

5454
const TRANSACTION_MOCK_2: TransactionMeta = {
5555
blockNumber: '234',
56+
hash: '0x2',
5657
chainId: '0x1',
5758
time: 1,
5859
transaction: { to: '0x1' },
59-
hash: '0x2',
6060
} as unknown as TransactionMeta;
6161

6262
const createRemoteTransactionSourceMock = (

packages/transaction-controller/src/TransactionController.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ jest.mock('@metamask/eth-query', () =>
8484
},
8585
getTransactionByHash: (_hash: string, callback: any) => {
8686
const txs: any = [
87-
{ hash: '1337', blockNumber: '0x1' },
88-
{ hash: '1338', blockNumber: null },
87+
{ blockNumber: '0x1', hash: '1337' },
88+
{ blockNumber: null, hash: '1338' },
8989
];
9090
const tx: any = txs.find((element: any) => element.hash === _hash);
9191
callback(undefined, tx);
@@ -99,15 +99,15 @@ jest.mock('@metamask/eth-query', () =>
9999
getTransactionReceipt: (_hash: any, callback: any) => {
100100
const txs: any = [
101101
{
102-
hash: '1337',
102+
blockHash: '1337',
103103
gasUsed: '0x5208',
104+
hash: '1337',
104105
status: '0x1',
105106
transactionIndex: 1337,
106-
blockHash: '1337',
107107
},
108108
{
109-
hash: '1111',
110109
gasUsed: '0x1108',
110+
hash: '1111',
111111
status: '0x0',
112112
transactionIndex: 1111,
113113
},
@@ -118,9 +118,9 @@ jest.mock('@metamask/eth-query', () =>
118118
getBlockByHash: (_blockHash: any, callback: any) => {
119119
const blocks: any = [
120120
{
121+
baseFeePerGas: '0x14',
121122
hash: '1337',
122123
number: '0x1',
123-
baseFeePerGas: '0x14',
124124
timestamp: '628dc0c8',
125125
},
126126
{ hash: '1338', number: '0x2' },
@@ -395,21 +395,21 @@ const NONCE_MOCK = 12;
395395
const ACTION_ID_MOCK = '123456';
396396

397397
const TRANSACTION_META_MOCK = {
398+
hash: '0x1',
398399
status: TransactionStatus.confirmed,
400+
time: 123456789,
399401
transaction: {
400402
from: ACCOUNT_MOCK,
401403
},
402-
hash: '0x1',
403-
time: 123456789,
404404
} as TransactionMeta;
405405

406406
const TRANSACTION_META_2_MOCK = {
407+
hash: '0x2',
407408
status: TransactionStatus.confirmed,
409+
time: 987654321,
408410
transaction: {
409411
from: '0x3',
410412
},
411-
hash: '0x2',
412-
time: 987654321,
413413
} as TransactionMeta;
414414

415415
describe('TransactionController', () => {
@@ -1378,10 +1378,10 @@ describe('TransactionController', () => {
13781378

13791379
controller.state.transactions.push({
13801380
from: MOCK_PREFERENCES.state.selectedAddress,
1381+
hash: '1337',
13811382
id: 'foo',
13821383
networkID: '5',
13831384
status: TransactionStatus.submitted,
1384-
hash: '1337',
13851385
} as any);
13861386

13871387
controller.wipeTransactions();
@@ -1457,12 +1457,12 @@ describe('TransactionController', () => {
14571457
const controller = newController();
14581458

14591459
controller.state.transactions.push({
1460+
chainId: toHex(5),
14601461
from: MOCK_PREFERENCES.state.selectedAddress,
1462+
hash: '1337',
14611463
id: 'foo',
14621464
networkID: '5',
1463-
chainId: toHex(5),
14641465
status: TransactionStatus.submitted,
1465-
hash: '1337',
14661466
} as any);
14671467

14681468
controller.state.transactions.push({} as any);
@@ -1484,10 +1484,10 @@ describe('TransactionController', () => {
14841484

14851485
controller.state.transactions.push({
14861486
from: MOCK_PREFERENCES.state.selectedAddress,
1487+
hash: '1337',
14871488
id: 'foo',
14881489
networkID: '5',
14891490
status: TransactionStatus.submitted,
1490-
hash: '1337',
14911491
} as any);
14921492

14931493
controller.state.transactions.push({} as any);
@@ -1523,16 +1523,16 @@ describe('TransactionController', () => {
15231523
const controller = newController();
15241524

15251525
controller.state.transactions.push({
1526+
chainId: toHex(5),
15261527
from: MOCK_PREFERENCES.state.selectedAddress,
1528+
hash: '1337',
15271529
id: 'foo',
15281530
networkID: '5',
1529-
chainId: toHex(5),
15301531
status: TransactionStatus.confirmed,
1531-
hash: '1337',
1532-
verifiedOnBlockchain: false,
15331532
transaction: {
15341533
gasUsed: undefined,
15351534
},
1535+
verifiedOnBlockchain: false,
15361536
} as any);
15371537

15381538
await controller.queryTransactionStatuses();
@@ -1779,10 +1779,10 @@ describe('TransactionController', () => {
17791779
it('creates approvals for all unapproved transaction', async () => {
17801780
const transaction = {
17811781
from: ACCOUNT_MOCK,
1782+
hash: '1337',
17821783
id: 'mocked',
17831784
networkID: '5',
17841785
status: TransactionStatus.unapproved,
1785-
hash: '1337',
17861786
};
17871787
const controller = newController();
17881788
controller.state.transactions.push(transaction as any);

0 commit comments

Comments
 (0)