Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/TransactionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ const MOCK_FETCH_TX_HISTORY_DATA_OK = {
transactionIndex: '13',
txreceipt_status: '1',
value: '50000000000000000'
},
{
blockNumber: '4535106',
confirmations: '4',
contractAddress: '',
cumulativeGasUsed: '693910',
from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',
gas: '335208',
gasPrice: '20000000000',
gasUsed: '21000',
hash: '0x342e9d73e10004af41d04973139fc7219dbadcbb5629730cfe65e9f9cb15ff91',
input: '0x11',
isError: '0',
nonce: '1',
timeStamp: '1543596356',
to: '0xb2d191b6fe03c5b8a1ab249cfe88c37553357a23',
transactionIndex: '13',
txreceipt_status: '1',
value: '50000000000000000'
}
],
status: '1'
Expand Down Expand Up @@ -391,7 +410,7 @@ describe('TransactionController', () => {

const from = '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207';
const latestBlock = await controller.fetchAll(from);
expect(controller.state.transactions.length).toBe(3);
expect(controller.state.transactions.length).toBe(4);
expect(latestBlock).toBe('4535101');
expect(controller.state.transactions[0].transaction.to).toBe(from);
});
Expand Down
2 changes: 1 addition & 1 deletion src/TransactionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ export class TransactionController extends BaseController<TransactionConfig, Tra
/* istanbul ignore else */
if (tx.toSmartContract === undefined) {
// If not `to` is a contract deploy, if not `data` is send eth
if (tx.transaction.to || !tx.transaction.data || tx.transaction.data !== '0x') {
if (tx.transaction.to && (!tx.transaction.data || tx.transaction.data !== '0x')) {
const code = await this.query('getCode', [tx.transaction.to]);
tx.toSmartContract = isSmartContractCode(code);
} else {
Expand Down